Configure MySQL for local and remote access

 ̄綄美尐妖づ 提交于 2019-12-06 02:56:47

Add a line over bind-address = 0.0.0.0 with [mysqld] like:

[mysqld]
bind-address = 0.0.0.0

In your case both, the server and the local client, reads the bind address and the client want to connect to the IP 0.0.0.0

According to this link it seems that the mysql client doesn’t recognize the bind address.

In order to connect locally I have to use this line:

mysql --no-defaults -u[username] -p[password] [database]

Just in case - I first put the bind-address between the lines and it did not work after

systemctl restart mysqld

With bind-address at the end it worked:

# The MariaDB configuration file 
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

[mysqld]
bind-address = 0.0.0.0
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!