Mysql
MySql 社區伺服器埠更改
我已經使用官方文件在 Oracle Linux 7 上安裝了 mysql-community-server 8.0
已經安裝成功,但是:
# service mysqld start
導致:
Redirecting to /bin/systemctl start mysqld.service Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. [root@myhost tmp]# journalctl -xe Oct 02 16:19:29 myhost systemd[1]: Starting MySQL Server... -- Subject: Unit mysqld.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysqld.service has begun starting up. Oct 02 16:19:39 myhost systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE Oct 02 16:19:39 myhost systemd[1]: Failed to start MySQL Server. -- Subject: Unit mysqld.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysqld.service has failed. -- -- The result is failed. Oct 02 16:19:39 myhost systemd[1]: Unit mysqld.service entered failed state. Oct 02 16:19:39 myhost systemd[1]: mysqld.service failed. [root@myhost tmp]# vi /var/log/mysqld.log 2019-10-02T13:19:36.151426Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 21346 2019-10-02T13:19:38.162471Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2019-10-02T13:19:38.165671Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use 2019-10-02T13:19:38.165697Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ? 2019-10-02T13:19:38.166475Z 0 [ERROR] [MY-010119] [Server] Aborting 2019-10-02T13:19:38.958654Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL. [root@myhost tmp]# ps aux | grep mysql root 2031 0.0 0.0 115388 3108 ? S 11:59 0:00 /bin/sh /opt/zbox/run/mysql/mysqld_safe --defaults-file=/opt/zbox/etc/mysql/my.cnf nobody 2487 0.0 0.4 525380 36448 ? Sl 11:59 0:00 /opt/zbox/run/mysql/mysqld --defaults-file=/opt/zbox/etc/mysql/my.cnf --basedir=/opt/zbox/run/mysql --datadir=/opt/zbox/data/mysql --plugin-dir=/opt/zbox/run/lib/mysql/plugin --user=nobody --log-error=/opt/zbox/logs/mysql_error.log --pid-file=/opt/zbox/tmp/mysql/mysqld.pid --socket=/opt/zbox/tmp/mysql/mysql.sock --port=3306
我發現 mysql-community-server 的配置文件位於 path:
/etc/my.cnf
. 但它不包含有關埠設置的資訊。/etc/my.cnf.d/
文件夾為空。我怎麼能改變它的埠?
https://dev.mysql.com/doc/refman/8.0/en/using-systemd.html#systemd-multiple-mysql-instances表明埠可能未在 systemd 單元中指定,
my.cnf
而是在mysqld.service
systemd 單元中指定。找到
mysqld.service
文件(嘗試/lib/systemd/system/
或/etc/systemd/system/
)並按照文件中的說明更改該文件中的埠。