无法在 Ubuntu 18.04 中更改 MySQL 端口

无法在 Ubuntu 18.04 中更改 MySQL 端口

我已经尝试了几个小时,但找不到问题所在。

vim /etc/mysql/my.cnf

>

!includedir /etc/mysql/conf.d/ 
!includedir /etc/mysql/mysql.conf.d/

[mysqld] 
port=3444

[client] 
user=root 
password=test123 
port=3444

下一个文件:

vim /etc/mysql/mysql.conf.d/mysqld.cnf

>

[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3444
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
# bind-address           = 127.0.0.1

然后我重新启动:

systemctl restart mysql.service

但在 mysql 控制台中,我仍然看到此信息。systemctl status mysql

mysql> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_support_xa        | ON    |
| large_files_support      | ON    |
| port                     | 3306  |
| report_host              |       |
| report_password          |       |
| report_port              | 3306  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
8 rows in set (0.00 sec)

相关内容