First, create a remote user (the root account only allows local connections. Considering security, a remote login account is generally set up)
Use the root account to log in to mysql
#mysql -u root -p root的密码 mysql> GRANT ALL ON *.* TO admin@'%' IDENTIFIED BY 'admin' WITH GRANT OPTION;
The meaning of this sentence is to allow any computer with an IP address (that’s what the % above means) to access this MySQL Server using the admin account and password (admin),
Then configure phpmyadmin Configuration file
vim ./phpMyAdmin/libraries/config.default.php
# is about line 125
Change $cfg['Servers'][$i]['host'] = 'localhost'
to $cfg['Servers'][$i]['host'] = 'Remote database server IP address', generally localhost can be used
Now log in to phpMyAdmin on the webpage
Enter the remote database Account and password, here are admin and admin (depending on the account and password of the remote user you created in the previous step)
Enter the database of the remote server
Recommended related articles and tutorials: phpmyadmintutorial
The above is the detailed content of How to enable phpmyadmin to connect to the database remotely. For more information, please follow other related articles on the PHP Chinese website!