1、安装:sudo apt-get install mysql-server
2、配置mysql可以远程连接:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
修改:bind-address = 127.0.0.1
为:bind-address = 0.0.0.0
3、修改MySQL密码:
sudo mysqladmin -u root -p password
Enter password: 输入安装时没有设置的root密码,如果没有则可以随便输
New password:
Confirm new password:
4、开启root远程登录的权限:
sudo mysql #超级用户进入mysql
->USE mysql;
->update user set host='%' where user='root' and host='localhost';
->update mysql.user set plugin='mysql_native_password' where user='root';
->FLUSH PRIVILEGES;
->exit;
5、重新启动mysql:
sudo service mysql restart
或者:
sudo service mysql stop
sudo service mysql start
附:MySQL语句应用大全 http://www.cnblogs.com/yunf/archive/2011/04/12/2013448.html