Remotely connect to MySQL database in Ubuntu environment

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

Remotely connect to MySQL database in Ubuntu environment
Remotely connect to Ubuntu via XShell
How to install mysql in Ubuntu 14.04
How to install mysql in Ubuntu 14.04
How to configure TensorFlow use environment in Ubuntu
How to install python in ubuntu server environment
Installation and simple practice of MySQL in ubuntu environment (1)
How to create a Python virtual environment in Ubuntu 14.04
Mac uses vnc to remotely log in to the ubuntu16.04 desktop
How to install memcache and start it in ubuntu environment
How to compile and install PHP and Nginx in Ubuntu environment
How to install Helm in Ubuntu
How to install MySQL on Ubuntu 20.04
How to use hanlp in ubuntu
How to install MySQL on Ubuntu 20.04
MySQL connected to remote Ubuntu server
How to install MySQL on Ubuntu 14.04
Steps to upgrade Laravel 5.4 to 5.6 in Ubuntu 16.04
Detailed steps to install MySQL to change the default password in Ubuntu
How to compile and install xdebug from source code in Ubuntu environment
How to add swap partition in Ubuntu
How to easily compile openJDK in Ubuntu
How to install cuda10.1 driver in Ubuntu
How to install MySQL on Ubuntu 18.04 (linux)
How to add users to Sudoers in Ubuntu
Configure Java development environment in Ubuntu20.04 LTS
How to delete redundant kernels in Ubuntu
How to delete redundant kernels in Ubuntu
Steps to build LNMP environment on ubuntu 20.04
Beautify Ubuntu 18.04 to Mac style in 5 minutes
How to install ROS Noetic in Ubuntu20.04
How to set static IP in ubuntu14.04
Download OpenJDK11 source code in Ubuntu environment
Solution to the problem that ubuntu cannot connect to the Internet in the virtual machine
How to modify software source in Ubuntu 7.10
How to open root account in Ubuntu20.04
Advantages of using apt command to download management package in Ubuntu environment
How to connect to wifi on ubuntu20.04 (2 types)
How to change MySQL password under Ubuntu
Configure Nginx + PHP 7.0 + MySQL environment under Ubuntu 16.04
Docker those things in the Ubuntu environment
Edit OpenJDK11 source code in Ubuntu environment
How to hide applications in Ubuntu Dash?
How to modify time zone and time in ubuntu
Solution for Ubuntu unable to connect to the network
Dry goods | Use Python to operate mysql database
Use rsync to remotely backup data under Ubuntu
How to use dpkg command in Ubuntu system
How to open the ubuntu system in win10
Install Python3 environment in a brand new Ubuntu
How to configure /var/log/messages in Ubuntu system log
Introduction to the use of Hanlp in ubuntu
How to enable Mysql remote access under Ubuntu 14.04
Installation and use of SSH in Ubuntu environment
How to install the latest MySQL on Ubuntu 18.04
xshell connect ubuntu
Ubuntu14 upgrade MySQL
Solution to the virtual machine ubuntu16.04 cannot connect to the Internet
Embedded Linux development environment to build and configure Ubuntu
What are the methods for python to connect to mysql
How to install and use MySQL Workbench on Ubuntu 18.04