Home > Article > Backend Development > How to configure ubuntu's mysql to be accessible from the external network
1. Use apt-get mysql-server mysql-client to install mysql and correctly configure the mysql user password. It can be accessed locally through phpmyadmin, but it cannot be accessed within the LAN. The modified mysql configuration file has only a few lines as follows
Where is the real configuration file of mysql under ubuntu?
1. Use apt-get mysql-server mysql-client to install mysql and correctly configure the mysql user password. It can be accessed locally through phpmyadmin, but cannot be accessed within the LAN. The modified mysql configuration file has only a few lines as follows
Where is the real configuration file of mysql under ubuntu?
The mysql
configuration file installed by default is located in /etc/mysql/mysql.conf.d/
, and the mysql
installed by default can only be logged in on this machine with the root
account
To achieve remote login to mysql, you need to authorize the account within mysql. Modifying the mysql configuration file cannot achieve this function.
The specific command is:
GRANT ALL PRIVILEGES ON . TO 'username'@'%' IDENTIFIED BY 'password'; Grant remote login permission
GRANT ALL PRIVILEGES ON database.* TO 'username'@'%' IDENTIFIED BY 'password'; Grant remote login to only access a certain database (database)
FLUSH PRIVILEGES; effective immediately
The found location is:/etc/mysql/mysql.conf.d/mysqld.cnf
The real configuration file is this
Modify the monitoring configuration. [mysqld]
bind-address = Set to the ip address to connect to. If you don’t know your IP, please comment it out