0

I've installed mysql-community-server 8.0 on Oracle Linux 7 using official documentation

It have been installed successfully, but:

# service mysqld start

resulted in:

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

I've found that mysql-community-server's configuration file located by path: /etc/my.cnf. But it contains no information about port setting. /etc/my.cnf.d/ folder is empty.

How could I change its port?

  • 1
    From the same official documentation you link to docs.oracle.com/cd/E17952_01/mysql-5.7-en/… – Grump Oct 2 at 14:34
  • 1
    However, you are likely to run into other issues running two versions of Mysql on the same machine -- pid files, database directories, sockets, .... – Grump Oct 2 at 14:37
  • yes, I've used port = 3307 in config file and mysqld started, but I could not log in into it: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES). You're right! – Gryu Oct 2 at 14:42
2

https://dev.mysql.com/doc/refman/8.0/en/using-systemd.html#systemd-multiple-mysql-instances suggests that the port may not specified in my.cnf but in the mysqld.service systemd unit.

Locate the mysqld.service file (try /lib/systemd/system/ or /etc/systemd/system/) and change the port inside that file as explained in the documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.