Ubuntu 16.04 install mysql

1) Install

sudo apt-get install mysql-server
apt-get isntall mysql-client
apt-get install libmysqlclient-dev

2) Verify

sudo netstat -tap | grep mysql

If there is

It means that the installation has been successful.

3) Enable remote access

1. vi /etc/mysql/my.cnf annotate bind-address = 127.0.0.1 (the configuration file may not be here, other configuration files under /etc/mysql/)

2. Authorize

root@sendo-ubuntu:mysql -uroot -padmin  (root表示用户名,admin表示密码)
root@sendo-ubuntu:use mysql;
root@sendo-ubuntu:update user set host = '%' where user = 'root';(这一句执行完可能会报错,不用管它。)
root@sendo-ubuntu:FLUSH PRIVILEGES;

3. Restart /etc/init.d/mysql restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325725725&siteId=291194637