mysql linux下配置本地实现数据库远程连接

mysql linux下配置本地实现数据库远程连接

首先在linux 下配置文件

vim /etc/mysql/mysql.conf.d/mysqld.cnf 

进入到文件mysqld.cnf内

 38 lc-messages-dir = /usr/share/mysql
 39 skip-external-locking
 40 #
 41 # Instead of skip-networking the default is now to listen only on
 42 # localhost which is more compatible and is not less secure.
 43  bind-address       = 0.0.0.0
 44 #
 45 # * Fine Tuning

取消band-address 注释并将后面的地址改为0.0.0.0,也就是mysql的本机,也就是linux系统的地址。

配置mysql root用户连接权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'zaq123' WITH GRANT OPTION;

然后更新权限配置

flush privileges;

通过linux 下ifconfig查看得到IP地址。
之后就能在window,或者其他linux下实现对数据库的连接与操作

修改账号密码:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('admin123');

猜你喜欢

转载自blog.csdn.net/newbietan/article/details/80432845