Ubuntu Server 16.04 install MySQL setup of error:10061 a perfect solution for remote access problems

  • 2020-05-10 23:25:06
  • OfStack

Description:

A friend had a problem installing MySQL using Ubuntu Server 16.04 and setting up remote access. Please help me. However, I haven't used Ubuntu to install MySQL either, so I've searched a lot of technical files to get the hang of it. However, due to the differences in the MySQL version, there were some problems during the installation setup: it could not be accessed remotely.

1. Install mysql

1. root account is required for installation. If you do not have root account, please refer to other articles of Linux commune. When installing mysql, you need to set the password of mysql's root account. Don't ignore it.


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

2. After the installation of the above three software packages is completed, use the following command to check whether the installation is successful:


sudo netstat -tap | grep mysql

The query results are shown in the figure below, indicating that the installation was successful.


root@linuxidc.com:~# netstat -tap | grep mysql
tcp6 0 0 [::]:mysql [::]:* LISTEN 7510/mysqld
root@linuxidc.com:~#

2. Set up mysql remote access

1. Edit the mysql configuration file and comment bind-address = 127.0.0.1


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

2. Use root to enter the mysql command line and execute the following two commands. In the example, mysql's root account password is root


grant all on *.* to root@'%' identified by 'root' with grand option;
flush privileges;

3. Restart mysql


/etc/init.d/mysql restart

3. Set account permissions

Authorize the user

I used the root password 123456

Example:


GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

When you're done, wait


mysql:flush privileges;

Refresh the permissions 1 time, do not need to restart

After a successful restart, you can log in on another computer.


Related articles: