sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo cat /etc/mysql/debian.cnf //查看默认用户名密码
debian.cnf 文件的内容:
Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = 2P8qKnlt45CuqHvL
socket = /var/run/mysqld/mysqld.sock
[ mysql_upgrade]
host = localhost
user = debian-sys-maint
password = 2P8qKnlt45CuqHvL
socket = /var/run/mysqld/mysqld.sock
使用默认用户名密码登陆并更新root账号密码:
mysql -u debian-sys-maint -p
输入密码
mysql> use mysql;
mysql> select host,user,plugin,authentication_string from user;
mysql> update user set plugin="mysql_native_password",authentication_string=password('新密码') where user="root";
mysql> FLUSH PRIVILEGES;
使用root登陆:
mysql -u root -p
输入新密码
mysql>
Hello There! Have A Good Day!
不错不错 谢谢博主 一次过!