MySQL Server 开启远程访问

发布于: 22 August, 2014
分享:

系统环境

  • 操作系统:Ubuntu Server 22.04
  • MySQL 版本:8.0.30-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))

修改 my.cnf 配置文件

$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

 

修改 bind-address

# If MySQL is running as a replication slave, this should be
# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
# tmpdir                = /tmp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 0.0.0.0
mysqlx-bind-address     = 127.0.0.1

 

修改权限

$ mysql -u root -p
mysql>GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;

0 留言

留言

您的留言将被人工审核,请勿发表色情、反动言论。

您可能感兴趣

如何修改或迁移 Postgres 数据库存储路径

迁移 PostgreSQL 数据文件夹到非系统盘可提高性能、减轻系统负担,降低系统盘故障风险,提升数据库的稳定性...

Ubuntu Server LTS 安装 PostgreSQL

Ubuntu 20.04 LTS 安装 PostgreSQL 14 数据库