更新时间:2022-11-12 16:17:07
首先,您需要通过编辑my.cnf
文件并注释以bind-address
开头的行来允许远程连接,如下所示(您也可以更改127.0.0.1
通过您的计算机的IP地址):
Firstly, you need to allow remote connections by editing my.cnf
file and commenting the line that starts with bind-address
as follows (You may also just change 127.0.0.1
by your machine ip address):
#bind-address = 127.0.0.1
然后重新启动mysql服务:
Then restart mysql service:
sudo service mysql restart
授予用户权限,如下所示:
Grant privileges to your user as follows:
mysql> CREATE USER 'root'@'172.30.10.%' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.30.10.%'
要仅在Etat_Civil
上授予特权,您可以尝试:
To grant privileges only on Etat_Civil
, you can try:
mysql> GRANT ALL PRIVILEGES ON Etat_Civil.* TO 'root'@'172.30.10.%'