Home > Database > Mysql Tutorial > How Can I Grant Remote Root Access to My MySQL Server?

How Can I Grant Remote Root Access to My MySQL Server?

Patricia Arquette
Release: 2024-12-03 16:56:11
Original
971 people have browsed it

How Can I Grant Remote Root Access to My MySQL Server?

Granting Remote Root Access in MySQL

You have encountered an issue where you cannot access MySQL's root user from your personal computer, despite granting '%'-based access to the server. To resolve this issue, follow these steps:

  1. Grant Privileges:

As the root user in MySQL, execute the following command to grant all privileges to the root user from any host (%):

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
Copy after login
  1. Bind to All Addresses:

You need to allow MySQL to listen on all network interfaces. Comment out the following line in /etc/mysql/mysql.conf.d/mysqld.cnf (or /etc/mysql/my.cnf on older versions):

#bind-address = 127.0.0.1 
Copy after login
  1. Restart MySQL:

Restart MySQL to apply the changes:

service mysql restart
Copy after login

Check that MySQL is now listening on all interfaces by running the following command:

netstat -tupan | grep mysql
Copy after login

If the issue persists, ensure that your firewall allows connections to port 3306 from the external IP addresses you are trying to connect from.

The above is the detailed content of How Can I Grant Remote Root Access to My MySQL Server?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template