Ubuntu15中开启MySQL远程访问效能
Ubuntu15中开启MySQL远程访问功能
不太熟悉,研究了好长时间
首先参考(大多博客都是这么写的)
http://java-my-life.iteye.com/blog/1202015
但是遇到问题
1./etc/mysql/my.cnf这个文件没有找到bind-address = 127.0.0.1,也就是配置参数是空的
经过多方查找发现在/etc/mysql/mysql.conf.d/mysqld.cnf中
1.可能/etc/mysql/mysql.conf.d/mysqld.cnf中也是空的
解决办法
按照这里面的方法执行三个命令:http://computerbeginnersguides.com/blog/2015/11/04/install-mysql-server-on-ubuntu-15-10/
具体步骤:
1.sudo apt-get install mysql-server-5.6 其中询问就输入 y
2.sudo mysql_install_db
3.sudo mysql_secure_installation
具体提示和输入值
Enter current password for root (enter for none): 123456
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] n
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] n
Reload privilege tables now? [Y/n] y
执行完以上步骤/etc/mysql/mysql.conf.d/mysqld.cnf中就有bind-address = 127.0.0.1了
上面执行完毕后执行如下就可以了:
1.service mysql stop
2.将 bind-address = 127.0.0.1 改成 bind-address = 0.0.0.0(注意在/etc/mysql/mysql.conf.d/mysqld.cnf里面)
3.service mysql start
4.mysql -u root -p(记住输入密码:123456)
5.update user set host = '%' where user ='root' and host='localhost';(要加host='localhost'这个条件,否则主键冲突,好多博客没说这个)
6.flush privileges;
7.可以查看是否设置成功select host, user from user;
8.可以查看netstat -an | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
记住Ubuntu要先支持ssh服务,这个可以网上找找,比较简单
完毕
不太熟悉,研究了好长时间
首先参考(大多博客都是这么写的)
http://java-my-life.iteye.com/blog/1202015
但是遇到问题
1./etc/mysql/my.cnf这个文件没有找到bind-address = 127.0.0.1,也就是配置参数是空的
经过多方查找发现在/etc/mysql/mysql.conf.d/mysqld.cnf中
1.可能/etc/mysql/mysql.conf.d/mysqld.cnf中也是空的
解决办法
按照这里面的方法执行三个命令:http://computerbeginnersguides.com/blog/2015/11/04/install-mysql-server-on-ubuntu-15-10/
具体步骤:
1.sudo apt-get install mysql-server-5.6 其中询问就输入 y
2.sudo mysql_install_db
3.sudo mysql_secure_installation
具体提示和输入值
Enter current password for root (enter for none): 123456
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] n
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] n
Reload privilege tables now? [Y/n] y
执行完以上步骤/etc/mysql/mysql.conf.d/mysqld.cnf中就有bind-address = 127.0.0.1了
上面执行完毕后执行如下就可以了:
1.service mysql stop
2.将 bind-address = 127.0.0.1 改成 bind-address = 0.0.0.0(注意在/etc/mysql/mysql.conf.d/mysqld.cnf里面)
3.service mysql start
4.mysql -u root -p(记住输入密码:123456)
5.update user set host = '%' where user ='root' and host='localhost';(要加host='localhost'这个条件,否则主键冲突,好多博客没说这个)
6.flush privileges;
7.可以查看是否设置成功select host, user from user;
8.可以查看netstat -an | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
记住Ubuntu要先支持ssh服务,这个可以网上找找,比较简单
完毕