mysql5.7 ubuntu 17安装
[root]sudo apt-get install mysql-server
过程中设置好root用户密码
[root]mysql -uroot -p
mysql>use user;
mysql>update user set host= '%' where user= 'root';
mysql> grant all on *.* to admin@'%' identified by 'root' with grant option;
mysql> quit;
[root] vi /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉 #bind-address = 127.0.0.1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
表示root用户密码错误了
修改/etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
skip-grant-tables
[root]sudo /etc/init.d/mysql restart
[root]mysql
mysql>use user;
mysql>update user set authentication_string = password("root") where user= 'root';
mysql> flush privileges;
mysql> quit;
修改 sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
#skip-grant-tables
[root]sudo /etc/init.d/mysql restart