The solution of 2003 can’t connect to MySQL server on ‘localhost’ (10061)

Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>

Problem description

Bloggers today use the database to find such a problem:

The Internet said that the database needs to be configured, but they didn’t come to the point. We need to configure the remote access port of the server

Answer to the question

Use the following command:

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 

Then change the place in the figure to 0.0.0.0:

Don’t forget to restart MySQL service:

sudo service mysql restart

Then run again, you can connect

Similar Posts: