1.更改mysql配置文件:
/etc/mysql/mysql.conf.d/mysqld.cnf
注掉 bind-address = 127.0.0.1
2.重启MySQL:sudo /etc/init.d/mysql restart
3.授权用户能进行远程连接
首先登陆数据库
然后 输入:grant all privileges on *.* to root@"%" identified by "123456" with grant option;
最后输入:flush privileges;
错误解决方法:
1)The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement解决方法
先刷新一下权限表。
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
#把在所有数据库的所有表的所有权限赋值给位于所有IP地址的root用户。
mysql> grant all on cactidb.* to dbuser@'localhost' identified by '123';
Query OK, 0 rows affected (0.00 sec)
2)客户端安装
sudo apt-get install mysql-client
3) Ubuntu系统 MySQL出现ERROR 1524 (HY000): Plugin ‘auth_socket’ is not loaded错误的解决方法
在终端上输入以下命令重启MySQL:
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start