Steve Larson
New Pleskian
Hello,
I recently was adding DevOps on my FC25 Linux and it came to my attention that MySQL had issues(was not running), would not start.
So I removed using sudo dnf remove mysql...
Then went and performed fresh install.
I have done this several times and come up with the mysqld will not start, hence step 2) fails:
1) Fails to initialize, complains of existing Data Directories I believe I fixed that by simply renaming data to 1data
sudo /usr/sbin/mysqld --defaults-file=/opt/mysql/mysql/etc/my.cnf --initialize --user=mysql
2) Then wanted to reset the password as follows:
/usr/bin/mysqladmin -u root password 'My2Secure$Password'
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
cat /opt/mysql/mysql/etc/my.cnf
[mysqld]
user=mysql
basedir=/opt/mysql/mysql
datadir=/opt/mysql/mysql/data
sudo ls -alt /opt/mysql/mysql
total 28
drwxr-x---. 5 mysql mysql 4096 Sep 16 14:21 data
drwxr-xr-x. 7 mysql mysql 4096 Sep 16 14:21 .
drwxr-xr-x. 2 mysql mysql 4096 Sep 16 12:18 etc
drwxr-xr-x. 5 mysql mysql 4096 Sep 16 12:14 1data
drwxr-xr-x. 3 mysql mysql 4096 Sep 15 22:54 ..
drwxr-xr-x. 3 mysql mysql 4096 Sep 15 22:50 share
drwxr-xr-x. 5 mysql mysql 4096 Sep 15 22:49 ORIGdata
Not certain what I am overlooking here, have removed the /opt/mysql/mysql/data directory
re-installed, same result...
Output of sudo service mysqld start
sudo systemctl start mysqld
[sudo] password for userxyz:
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
Output from systemctl status mysqld.service
sudo systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: deactivating (final-sigterm) (Result: exit-code)
Docs: man:mysqld(8)
MySQL :: MySQL 5.7 Reference Manual :: 2.5.10 Managing MySQL Server with systemd
Process: 3649 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 3620 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Tasks: 18 (limit: 4915)
Memory: 183.1M
CPU: 715ms
CGroup: /system.slice/mysqld.service
└─3652 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Sep 16 15:48:31 server001 systemd[1]: Starting MySQL Server...
Sep 16 15:48:31 server001 mysqld_pre_systemd[3620]: 2017-09-16T19:48:31.994418Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprec
Sep 16 15:48:31 server001 mysqld_pre_systemd[3620]: 2017-09-16T19:48:31.995435Z 0 [ERROR] --initialize specified but the data directory has
Sep 16 15:48:31 server001 mysqld_pre_systemd[3620]: 2017-09-16T19:48:31.995479Z 0 [ERROR] Aborting
Sep 16 15:48:32 server001 systemd[1]: mysqld.service: Control process exited, code=exited status=1
Output from journalctl -xe
Sep 16 15:52:55 server001 mysqld_pre_systemd[9351]: 2017-09-16T19:52:55.247758Z 0 [ERROR] Aborting
Sep 16 15:52:55 server001 mysqld[9379]: Initialization of mysqld failed: 0
Sep 16 15:52:55 server001 systemd[1]: mysqld.service: Control process exited, code=exited status=1
Sep 16 15:52:57 server001 systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: systemd-devel Info Page
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
Sep 16 15:52:57 server001 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mysqld comm="
Sep 16 15:52:57 server001 systemd[1]: mysqld.service: Unit entered failed state.
Sep 16 15:52:57 server001 systemd[1]: mysqld.service: Failed with result 'exit-code'.
Sep 16 15:52:57 server001 systemd[1]: mysqld.service: Service hold-off time over, scheduling restart.
Sep 16 15:52:57 server001 systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: systemd-devel Info Page
--
-- Unit mysqld.service has finished shutting down.
Sep 16 15:52:57 server001 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mysqld comm="
Sep 16 15:52:57 server001 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mysqld comm="s
Sep 16 15:52:57 server001 systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: systemd-devel Info Page
--
-- Unit mysqld.service has begun starting up.
Sep 16 15:52:57 server001 mysqld_pre_systemd[9427]: 2017-09-16T19:52:57.994706Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Plea
Sep 16 15:52:57 server001 mysqld_pre_systemd[9427]: 2017-09-16T19:52:57.995859Z 0 [ERROR] --initialize specified but the data directory has files in
Sep 16 15:52:57 server001 mysqld_pre_systemd[9427]: 2017-09-16T19:52:57.995895Z 0 [ERROR] Aborting
Sep 16 15:52:58 server001 mysqld[9455]: Initialization of mysqld failed: 0
Sep 16 15:52:58 server001 systemd[1]: mysqld.service: Control process exited, code=exited status=1
Sep 16 15:52:59 server001 sudo[9484]: userxyz : TTY=pts/3 ; PWD=/home/userxyz ; USER=root ; COMMAND=/bin/journalctl -xe
Sep 16 15:52:59 server001 audit[9484]: USER_CMD pid=9484 uid=1001 auid=1001 ses=5 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='cwd
Sep 16 15:52:59 server001 audit[9484]: CRED_REFR pid=9484 uid=0 auid=1001 ses=5 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PA
Sep 16 15:52:59 server001 sudo[9484]: pam_systemd(sudo:session): Cannot create session: Already occupied by a session
Sep 16 15:52:59 server001 audit[9484]: USER_START pid=9484 uid=0 auid=1001 ses=5 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=P
Sep 16 15:52:59 server001 sudo[9484]: pam_unix(sudo:session): session opened for user root by userxyz(uid=0)
Thank you,
S. Larson
I recently was adding DevOps on my FC25 Linux and it came to my attention that MySQL had issues(was not running), would not start.
So I removed using sudo dnf remove mysql...
Then went and performed fresh install.
I have done this several times and come up with the mysqld will not start, hence step 2) fails:
1) Fails to initialize, complains of existing Data Directories I believe I fixed that by simply renaming data to 1data
sudo /usr/sbin/mysqld --defaults-file=/opt/mysql/mysql/etc/my.cnf --initialize --user=mysql
2) Then wanted to reset the password as follows:
/usr/bin/mysqladmin -u root password 'My2Secure$Password'
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
cat /opt/mysql/mysql/etc/my.cnf
[mysqld]
user=mysql
basedir=/opt/mysql/mysql
datadir=/opt/mysql/mysql/data
sudo ls -alt /opt/mysql/mysql
total 28
drwxr-x---. 5 mysql mysql 4096 Sep 16 14:21 data
drwxr-xr-x. 7 mysql mysql 4096 Sep 16 14:21 .
drwxr-xr-x. 2 mysql mysql 4096 Sep 16 12:18 etc
drwxr-xr-x. 5 mysql mysql 4096 Sep 16 12:14 1data
drwxr-xr-x. 3 mysql mysql 4096 Sep 15 22:54 ..
drwxr-xr-x. 3 mysql mysql 4096 Sep 15 22:50 share
drwxr-xr-x. 5 mysql mysql 4096 Sep 15 22:49 ORIGdata
Not certain what I am overlooking here, have removed the /opt/mysql/mysql/data directory
re-installed, same result...
Output of sudo service mysqld start
sudo systemctl start mysqld
[sudo] password for userxyz:
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
Output from systemctl status mysqld.service
sudo systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: deactivating (final-sigterm) (Result: exit-code)
Docs: man:mysqld(8)
MySQL :: MySQL 5.7 Reference Manual :: 2.5.10 Managing MySQL Server with systemd
Process: 3649 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 3620 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Tasks: 18 (limit: 4915)
Memory: 183.1M
CPU: 715ms
CGroup: /system.slice/mysqld.service
└─3652 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Sep 16 15:48:31 server001 systemd[1]: Starting MySQL Server...
Sep 16 15:48:31 server001 mysqld_pre_systemd[3620]: 2017-09-16T19:48:31.994418Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprec
Sep 16 15:48:31 server001 mysqld_pre_systemd[3620]: 2017-09-16T19:48:31.995435Z 0 [ERROR] --initialize specified but the data directory has
Sep 16 15:48:31 server001 mysqld_pre_systemd[3620]: 2017-09-16T19:48:31.995479Z 0 [ERROR] Aborting
Sep 16 15:48:32 server001 systemd[1]: mysqld.service: Control process exited, code=exited status=1
Output from journalctl -xe
Sep 16 15:52:55 server001 mysqld_pre_systemd[9351]: 2017-09-16T19:52:55.247758Z 0 [ERROR] Aborting
Sep 16 15:52:55 server001 mysqld[9379]: Initialization of mysqld failed: 0
Sep 16 15:52:55 server001 systemd[1]: mysqld.service: Control process exited, code=exited status=1
Sep 16 15:52:57 server001 systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: systemd-devel Info Page
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
Sep 16 15:52:57 server001 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mysqld comm="
Sep 16 15:52:57 server001 systemd[1]: mysqld.service: Unit entered failed state.
Sep 16 15:52:57 server001 systemd[1]: mysqld.service: Failed with result 'exit-code'.
Sep 16 15:52:57 server001 systemd[1]: mysqld.service: Service hold-off time over, scheduling restart.
Sep 16 15:52:57 server001 systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: systemd-devel Info Page
--
-- Unit mysqld.service has finished shutting down.
Sep 16 15:52:57 server001 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mysqld comm="
Sep 16 15:52:57 server001 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mysqld comm="s
Sep 16 15:52:57 server001 systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: systemd-devel Info Page
--
-- Unit mysqld.service has begun starting up.
Sep 16 15:52:57 server001 mysqld_pre_systemd[9427]: 2017-09-16T19:52:57.994706Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Plea
Sep 16 15:52:57 server001 mysqld_pre_systemd[9427]: 2017-09-16T19:52:57.995859Z 0 [ERROR] --initialize specified but the data directory has files in
Sep 16 15:52:57 server001 mysqld_pre_systemd[9427]: 2017-09-16T19:52:57.995895Z 0 [ERROR] Aborting
Sep 16 15:52:58 server001 mysqld[9455]: Initialization of mysqld failed: 0
Sep 16 15:52:58 server001 systemd[1]: mysqld.service: Control process exited, code=exited status=1
Sep 16 15:52:59 server001 sudo[9484]: userxyz : TTY=pts/3 ; PWD=/home/userxyz ; USER=root ; COMMAND=/bin/journalctl -xe
Sep 16 15:52:59 server001 audit[9484]: USER_CMD pid=9484 uid=1001 auid=1001 ses=5 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='cwd
Sep 16 15:52:59 server001 audit[9484]: CRED_REFR pid=9484 uid=0 auid=1001 ses=5 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PA
Sep 16 15:52:59 server001 sudo[9484]: pam_systemd(sudo:session): Cannot create session: Already occupied by a session
Sep 16 15:52:59 server001 audit[9484]: USER_START pid=9484 uid=0 auid=1001 ses=5 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=P
Sep 16 15:52:59 server001 sudo[9484]: pam_unix(sudo:session): session opened for user root by userxyz(uid=0)
Thank you,
S. Larson