简体   繁体   中英

How can I enable remote connections for MySQL

I have a MariaDB instance running with proper users set up. My my.cnf looks like this:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

symbolic-links=0

bind-address    = 0.0.0.0

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

!includedir /etc/my.cnf.d

I'm trying to connect to this DB from Windows MySQL Workbench as root and am getting

Unable to connect to MYSQL server on <servername>

When I run netstat -aonp | grep 3306 netstat -aonp | grep 3306 on my server I get:

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 12793/mysqld off (0.00/0/0)

All looks to be running just fine and my bind-address is set to all 0's.

What could I possibly be missing here?

也许是许可的问题

GRANT ALL PRIVILEGES ON *.* TO 'root'@'*' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Since this was a new VM, FirewallD was not running.

I needed to start FirewallD and add 3306/tcp to it:

firewall-cmd --add-port=3306/tcp

firewall-cmd --permanent --add-port=3306/tcp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM