The msyql database is installed on the Linux server. It can be accessed when accessed locally, but when I want to access it remotely, I cannot access it. After querying the information, I found that by default, MySQL under Linux only has local access after the installation is completed. permissions, there is no remote access permission. You need to set access permissions for the specified user to remotely access the database.
Preface
Learn MySQL to reorganize previous non-MK records
Description
If it is not enabled, an error will be reported when connecting to the database: 2003-can't connect to MYSQL
Method/step
•First step
Connect to the Linux system remotely and ensure that the MySQL database has been installed on the Linux system. Log in to the database.
mysql -u$user -p $pwd
GRANT ALL PRIVILEGES ON *.* TO '$username'@'%' IDENTIFIED BY '$password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
vim /etc/mysql/my.cnf
bind-address = 0.0.0.0(device address)
/etc/init.d/mysql restart
#View port number
show global variables like 'port';
Examples to explain how to modify mysql to enable remote connections
Example detailed explanation of the steps to configure MySQL remote connection under Alibaba Cloud
The reason why the mysql database cannot be connected remotely under Centos7 and the detailed solution
The above is the detailed content of Detailed explanation of MySQL remote connection method in Linux server. For more information, please follow other related articles on the PHP Chinese website!