image.png
Install MySQL
sudo apt-get update
sudo apt-get install mysql-server
sudo apt-get install libmysqlclient-dev
Login to MySQL
mysql -u root -p
Create user
REATE USER 'username'@'host' IDENTIFIED BY 'password';
Authorize for remote connection
GRANT ALL PRIVILEGES ON *.* TO 'Ubuntu'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Delete authorization
revoke insert,update,delete,select ON *.*from'Ubuntu'@'%' IDENTIFIED BY '123456';
Then open vi /etc/mysql/mysql.conf.d/mysqld.cnf
Set bind-address = 127.0.0.1
Set to bind-address = 0.0.0.0 (device address)
Tencent Cloud has insufficient permissions:
http://bbs.qcloud.com/thread-11554-1-1.html
Restart (the command is as follows):
/etc/init.d/mysql stop
/etc/init.d/mysql start
Execute flush privileges; the command takes effect immediately
flush privileges;
The user who queries the database (seeing the following content indicates that the new user is successfully created)
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
Use the exit command to exit MySQL
exit
Recommended Posts