设置root远程连接ubuntu上mysql

1.安装mysql,如果是root用户,直接执行一下命令.如果非root,则需要用sudo命令

 a. apt-get install mysql-server
b. apt
-get isntall mysql-client c.apt-get install libmysqlclient-dev
2.root用户本地连接mysql
mysql -u root -p 
  按照提示,输入root用户的密码即可.
3.启动或重启mysql
  
/etc/init.d/mysql start|stop|restart|reload|force-reload|status

4.设置root用户远程连接mysql

 grant all privileges on *.* to 'root'@'%' identified by 'admin123'
 flush privileges;

  如果还不能连接,报10061的错误,那就还需要改一个地方

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

 将bind-address = 127.0.0.1这一行用#号注释掉即可.

 

posted @ 2015-07-13 23:59  Cilimer  阅读(270)  评论(0编辑  收藏  举报