1.linux下安装需要root权限
sudo apt-get install mysql-server
sudo apt-get mysql-client
sudo apt-get libmysqlclient-dev
安装期间会提示输入密码 , 这个密码就是mysql的密码.
2.设置远程访问
vim /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉文件中的bind-address = 127.0.0.1
3.设置远程访问账号
mysql -u root -p
输入密码 , 进入mysql
输入use mysql
shuruupdate user set host = "%" where host = 'localhost';
输入grant all on *.* to root@'%' identified by 'root' with grant option;
输入flush privileges;
4.重启mysql
sudo service mysql restart
然后在其他服务器上看是否能够连接上mysql
网友评论