Home > Database > Mysql Tutorial > mysql允许远程连接的配置方法

mysql允许远程连接的配置方法

WBOY
Release: 2016-06-01 09:57:04
Original
1189 people have browsed it

默认情况下,MySQL只允许本地登录,如果要开启远程连接,则需要修改/etc/my.cnf文件

vim /etc/my.cnf

注释这一行:bind-address=127.0.0.1 ==> #bind-address=127.0.0.1

保存退出。

mysql -uroot -p123456

为需要远程登录的用户赋予权限:

<code class="language-sql">mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456";
mysql> flush privileges;</code>
Copy after login

远程登录命令:

mysql -h 223.4.92.130 -uroot -p(-h后跟的是要登录主机的ip地址)

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template