
























This tutorial will guide you through the steps to allow multiple devices to access your MySQL server over a network.
my.cnf or my.ini).C:\ProgramData\MySQL\MySQL Server X.X\my.ini/etc/mysql/my.cnf or /etc/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnfbind-address.bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0
This allows MySQL to accept connections from any IP address.net stop mysql
net start mysqlsudo systemctl restart mysqlsudo ufw allow 3306/tcp⚠️ Important: At this point MySQL will accept connections from anywhere. If your server is exposed to the internet, secure it:
mysql -u root -p%):CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Replace
usernameandpasswordwith your desired credentials.
On the client device, use the following command to connect:
mysql -h <server-ip-address> -u username -p
Replace <server-ip-address> with the IP address of your MySQL server.
edit: /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
max_allowed_packet = 128M
net_read_timeout = 120
net_write_timeout = 120
check using:
SHOW VARIABLES LIKE 'max_allowed_packet';
SHOW VARIABLES LIKE 'net_read_timeout';
SHOW VARIABLES LIKE 'net_write_timeout';
edit: /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
max_connections = 500
wait_timeout = 60
interactive_timeout = 60
check using
SHOW VARIABLES LIKE 'max_connections';
SHOW STATUS LIKE 'Threads_connected';
SHOW STATUS LIKE 'Threads_running';
% with a specific IP or subnet).You have now enabled MySQL access for multiple devices on your network!
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。