Solved Cannot start mysql

SAJM

Active Member

Reaction score: 12
Messages: 138

I have a ham radio log program CQRlog that uses mysql5.7. I works just fine. I'm running 12.2 on a laptop with KDE

When I installed CQRlog and mysql a few months back I could log into the mysql terminal as root or steve.

Today when I tried to log in to the mysql terminal using:

mysql -u steve -p

I received ERROR 2002 (HY000)

mysql-server will not start using the service start command but returns no error.

HOWEVER!!! CQRlog continues to work just fine. This tells me there have been no changes to the system and it is sound. I must be doing something silly - but what could it be?
 

Emrion

Aspiring Daemon

Reaction score: 209
Messages: 671

Weird... Is the service actually running?
# service mysql-server status
 

cmoerz

Member

Reaction score: 16
Messages: 46

Is it possible that you have a my.cnf or other option file in place that sets/overrides your connection options?
 

Emrion

Aspiring Daemon

Reaction score: 209
Messages: 671

No matter with or without GUI. What do you get if you try to start mysql-server?
# service mysql-server start
 
OP
S

SAJM

Active Member

Reaction score: 12
Messages: 138

Code:
$ su
Password:
root@:/usr/home/steve # service mysql-server start
Starting mysql.
root@:/usr/home/steve # service mysql-server status
mysql is not running.
root@:/usr/home/steve #
 

Emrion

Aspiring Daemon

Reaction score: 209
Messages: 671

Look in /var/db/mysql/<hostname>.err. Maybe you will find some clues.
 
OP
S

SAJM

Active Member

Reaction score: 12
Messages: 138

I'm not going to do that because I may break CQRlog.

I did it, it worked and did not break CQRlog. mysql is now running although I do have a password issue and cannot log in
 
OP
S

SAJM

Active Member

Reaction score: 12
Messages: 138

I did it, it worked and did not break CQRlog. mysql is now running although I do have a password issue and cannot log in

i tried to recover the password but am back to the original problem:

ERROR 2002 (HY000)

Code:
root@:/var/db/mysql # service mysql-server stop
Stopping mysql.
Waiting for PIDS: 4405.
root@:/var/db/mysql # mysql_safe --skip-grant=tables --skip networking &
[1] 4816
root@:/var/db/mysql # mysql_safe: Command not found.
mysqld_safe --skip-grant=tables --skip networking &
[2] 4817
[1]    Exit 1                        mysql_safe --skip-grant=tables --skip networking
root@:/var/db/mysql # 2021-05-24T10:52:11.6NZ mysqld_safe Logging to '/var/db/mysql/.err'.
2021-05-24T10:52:11.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
2021-05-24T10:52:15.6NZ mysqld_safe mysqld from pid file /var/db/mysql/.pid ended
mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[2]  + Done                          mysqld_safe --skip-grant=tables --skip networking
root@:/var/db/mysql # mysql -u root
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,626
Messages: 37,981

No error logs there
It's in /var/log/mysql/ nowadays. Look at the error logs, it seems to fail to start for whatever reason. Maybe you have a corrupted table or some other issue that prevents MySQL from starting correctly.

i tried to recover the password
The issue has nothing to do with your password. Your MySQL instance just refuses to start. You can't login if it's not started.
 

spectrum48

Member

Reaction score: 18
Messages: 47

From your output it's logging to a hidden file: /var/db/mysql/.err.
I think this file should be named after your hostname instead: your-hostname.err.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,626
Messages: 37,981

That's because SAJM tried to start it by hand, never do this (it won't pick up the configuration settings correctly).
 
OP
S

SAJM

Active Member

Reaction score: 12
Messages: 138

Here is the error file
Code:
2021-05-24T11:11:05.544443Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 210524 12:11:05
2021-05-24T11:11:06.783539Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2747690
2021-05-24T11:11:06.783839Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-05-24T11:11:06.783872Z 0 [Note] Shutting down plugin 'MEMORY'
2021-05-24T11:11:06.783885Z 0 [Note] Shutting down plugin 'CSV'
2021-05-24T11:11:06.783897Z 0 [Note] Shutting down plugin 'sha256_password'
2021-05-24T11:11:06.783906Z 0 [Note] Shutting down plugin 'mysql_native_password'
2021-05-24T11:11:06.784114Z 0 [Note] Shutting down plugin 'binlog'
2021-05-24T11:11:06.784529Z 0 [Note] /usr/local/libexec/mysqld: Shutdown complete

2021-05-24T11:11:06.6NZ mysqld_safe mysqld from pid file /var/db/mysql/.pid ended
2021-05-24T11:14:20.6NZ mysqld_safe Logging to '/var/db/mysql/.err'.
2021-05-24T11:14:20.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
2021-05-24T11:14:20.724912Z 0 [Note] /usr/local/libexec/mysqld (mysqld 5.7.33-log) starting as process 8650 ...
2021-05-24T11:14:20.774021Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-05-24T11:14:20.774081Z 0 [Note] InnoDB: Uses event mutexes
2021-05-24T11:14:20.774093Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-05-24T11:14:20.774104Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-05-24T11:14:20.774707Z 0 [Note] InnoDB: Number of pools: 1
2021-05-24T11:14:20.774883Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2021-05-24T11:14:20.778087Z 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
2021-05-24T11:14:21.101394Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-05-24T11:14:21.222439Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-05-24T11:14:21.340090Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-05-24T11:14:21.340220Z 0 [Note] InnoDB: Setting file '/var/db/mysql/ibtmp1' size to 128 MB. Physically writing the file full; Please wait ...
2021-05-24T11:14:21.341606Z 0 [Note] InnoDB: Progress in MB:
 100
2021-05-24T11:14:23.092145Z 0 [Note] InnoDB: File '/var/db/mysql/ibtmp1' size is now 128 MB.
2021-05-24T11:14:23.093834Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-05-24T11:14:23.093858Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-05-24T11:14:23.094264Z 0 [Note] InnoDB: Waiting for purge to start
2021-05-24T11:14:23.159554Z 0 [Note] InnoDB: 5.7.33 started; log sequence number 2747690
2021-05-24T11:14:23.160042Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-05-24T11:14:23.164925Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/db/mysql/ib_buffer_pool
2021-05-24T11:14:23.292785Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-05-24T11:14:23.292812Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-05-24T11:14:23.294814Z 0 [Warning] CA certificate ca.pem is self signed.
2021-05-24T11:14:23.294921Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-05-24T11:14:23.295201Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2021-05-24T11:14:23.295245Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2021-05-24T11:14:23.295390Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-05-24T11:14:23.389729Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210524 12:14:23
2021-05-24T11:14:23.429648Z 0 [Note] Failed to start slave threads for channel ''
2021-05-24T11:14:23.445237Z 0 [Note] Event Scheduler: Loaded 0 events
2021-05-24T11:14:23.445463Z 0 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '5.7.33-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
2021-05-24T11:51:01.308984Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2021-05-24T12:03:26.404852Z 3 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2021-05-24T12:03:37.083144Z 4 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2021-05-24T12:08:28.606194Z 5 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2021-05-24T12:10:06.694274Z 6 [Note] Access denied for user 'root'@'localhost' (using password: YES)
root@:/home/steve/Desktop #
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,626
Messages: 37,981

First of all, set a proper hostname in /etc/rc.conf.
 
OP
S

SAJM

Active Member

Reaction score: 12
Messages: 138

Having a hostname makes no difference although I have created one..
 
OP
S

SAJM

Active Member

Reaction score: 12
Messages: 138

I've been reading up on a few other threads here and tried the following:

Code:
root@ellamay:/usr/home/steve # service mysql-server start
/usr/local/etc/rc.d/mysql-server: WARNING: failed precmd routine for mysql
root@ellamay:/usr/home/steve # cd /usr/local/bin/
root@ellamay:/usr/local/bin # mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'prompt=\u@\h [\d]>\_'

Securing the MySQL server deployment.

Connecting to MySQL server using password in '/root/.mysql_secret'
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
root@ellamay:/usr/local/bin # cd .
root@ellamay:/usr/local/bin # cd /
root@ellamay:/ # cat .mysql_secret
cat: .mysql_secret: No such file or directory
root@ellamay:/ # cd /root
root@ellamay:~ # ls
.cache          .gtkrc-2.0      .local          .profile
.config         .history        .login          .Xauthority
.cshrc          .k5login        .mysql_history  Mail
.dbus           .kde            .mysql_secret   sent
root@ellamay:~ # cat .mysql_secret
# Password set for user 'root@localhost' at 2021-05-24 11:20:31 
HejxtLacyt*.
root@ellamay:~ #

Do I just edit .mysql_secret and change the password?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,626
Messages: 37,981

Code:
root@ellamay:/usr/home/steve # service mysql-server start 
/usr/local/etc/rc.d/mysql-server: WARNING: failed precmd routine for mysql
Check the permissions on the log files in /var/log/mysql.

Code:
Connecting to MySQL server using password in '/root/.mysql_secret' 
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
It failed to start, so there's nothing running.
 

tux2bsd

Active Member

Reaction score: 32
Messages: 134

If it is not too far gone try connecting with either: 127.0.0.1 or localhost or its network IP
Also, check firewall
My suggestions may have been more suitable earlier on though.
 
OP
S

SAJM

Active Member

Reaction score: 12
Messages: 138

There are no mysql files in in /var/log/




Code:
drwxr-xr-x   6 root  wheel      1536 26 May 09:32 .
drwxr-xr-x  25 root  wheel       512 26 May 09:29 ..
-rw-------   1 root  wheel      4691 26 May 09:50 auth.log
-rw-r--r--   1 root  wheel    279838  4 Mar 15:40 bsdinstall_log
-rw-r--r--   1 root  wheel      7789 26 May 09:33 bsdisks.log
drwxr-xr-x   2 root  wheel       512  5 Mar 00:57 ConsoleKit
-rw-------   1 root  wheel     63266 26 May 09:55 cron
drwxr-xr-x   2 root  wheel       512  5 Mar 00:49 cups
-rw-------   1 root  wheel      7789 26 May 09:33 debug.log
-rw-r--r--   1 root  wheel        55  4 Mar 15:44 devd.log
-rw-------   1 root  wheel     73970 25 May 03:14 dmesg.today
-rw-------   1 root  wheel     38512 24 May 03:13 dmesg.yesterday
-rw-r--r--   1 root  wheel        55  4 Mar 15:44 lpd-errs
-rw-r-----   1 root  wheel      3232 26 May 09:30 maillog
-rw-r-----   1 root  wheel       834 26 May 00:00 maillog.0.bz2
-rw-r-----   1 root  wheel       363 25 May 00:00 maillog.1.bz2
-rw-r-----   1 root  wheel       113 24 May 00:00 maillog.2.bz2
-rw-r-----   1 root  wheel       110 23 May 00:00 maillog.3.bz2
-rw-r-----   1 root  wheel       112 22 May 00:00 maillog.4.bz2
-rw-r-----   1 root  wheel       114 21 May 00:00 maillog.5.bz2
-rw-r-----   1 root  wheel       113 20 May 00:00 maillog.6.bz2
-rw-r--r--   1 root  wheel    304026 26 May 09:50 messages
-rw-r--r--   1 root  wheel     51974 15 May 17:00 messages.0.bz2
-rw-r--r--   1 root  wheel     51192  7 Apr 04:00 messages.1.bz2
-rw-r--r--   1 root  wheel     53255 14 Mar 13:00 messages.2.bz2
-rw-------   1 root  wheel        90  6 Mar 03:12 mount.today
-rw-------   1 root  wheel        58  5 Mar 03:12 mount.yesterday
drwx------   2 root  wheel       512 27 Mar 01:38 munge
-rw-r-----   1 root  network      55  4 Mar 15:44 ppp.log
drwxr-xr-x   2 root  wheel       512  5 Mar 01:03 samba4
-rw-r--r--   1 root  wheel      1770  5 Mar 14:50 sddm.log
-rw-------   1 root  wheel        55  4 Mar 15:44 security
-rw-r-----   1 root  wheel       728 26 May 03:24 sendmail.st
-rw-r-----   1 root  wheel       728 20 May 18:00 sendmail.st.0
-rw-r-----   1 root  wheel       728 13 May 18:00 sendmail.st.1
-rw-r-----   1 root  wheel       728  6 May 18:00 sendmail.st.2
-rw-r-----   1 root  wheel       728 29 Apr 18:00 sendmail.st.3
-rw-r-----   1 root  wheel       728 22 Apr 18:00 sendmail.st.4
-rw-r-----   1 root  wheel       728 15 Apr 18:00 sendmail.st.5
-rw-r-----   1 root  wheel       728  8 Apr 18:00 sendmail.st.6
-rw-r-----   1 root  wheel       728  1 Apr 18:00 sendmail.st.7
-rw-r-----   1 root  wheel       728 25 Mar 17:00 sendmail.st.8
-rw-r-----   1 root  wheel       728 18 Mar 17:00 sendmail.st.9
-rw-------   1 root  wheel      5108 13 Mar 03:08 setuid.today
-rw-------   1 root  wheel      5010  5 Mar 03:07 setuid.yesterday
-rw-------   1 root  wheel      2131  5 Mar 01:14 userlog
-rw-r--r--   1 root  wheel       394 26 May 09:50 utx.lastlogin
-rw-r--r--   1 root  wheel      7986 26 May 09:50 utx.log
-rw-r--r--   1 root  wheel     11949  1 May 05:00 utx.log.0
-rw-r--r--   1 root  wheel     36561  1 Apr 05:00 utx.log.1
-rw-r--r--   1 root  wheel    279838  4 Mar 15:40 bsdinstall_log
-rw-r--r--   1 root  wheel      7789 26 May 09:33 bsdisks.log
drwxr-xr-x   2 root  wheel       512  5 Mar 00:57 ConsoleKit
-rw-------   1 root  wheel     63266 26 May 09:55 cron
drwxr-xr-x   2 root  wheel       512  5 Mar 00:49 cups
-rw-------   1 root  wheel      7789 26 May 09:33 debug.log
-rw-r--r--   1 root  wheel        55  4 Mar 15:44 devd.log
-rw-------   1 root  wheel     73970 25 May 03:14 dmesg.today
-rw-------   1 root  wheel     38512 24 May 03:13 dmesg.yesterday
-rw-r--r--   1 root  wheel        55  4 Mar 15:44 lpd-errs
-rw-r-----   1 root  wheel      3232 26 May 09:30 maillog
-rw-r-----   1 root  wheel       834 26 May 00:00 maillog.0.bz2
-rw-r-----   1 root  wheel       363 25 May 00:00 maillog.1.bz2
-rw-r-----   1 root  wheel       113 24 May 00:00 maillog.2.bz2
-rw-r-----   1 root  wheel       110 23 May 00:00 maillog.3.bz2
-rw-r-----   1 root  wheel       112 22 May 00:00 maillog.4.bz2
-rw-r-----   1 root  wheel       114 21 May 00:00 maillog.5.bz2
-rw-r-----   1 root  wheel       113 20 May 00:00 maillog.6.bz2
-rw-r--r--   1 root  wheel    304026 26 May 09:50 messages
-rw-r--r--   1 root  wheel     51974 15 May 17:00 messages.0.bz2
-rw-r--r--   1 root  wheel     51192  7 Apr 04:00 messages.1.bz2
-rw-r--r--   1 root  wheel     53255 14 Mar 13:00 messages.2.bz2
-rw-------   1 root  wheel        90  6 Mar 03:12 mount.today
-rw-------   1 root  wheel        58  5 Mar 03:12 mount.yesterday
drwx------   2 root  wheel       512 27 Mar 01:38 munge
-rw-r-----   1 root  network      55  4 Mar 15:44 ppp.log
drwxr-xr-x   2 root  wheel       512  5 Mar 01:03 samba4
-rw-r--r--   1 root  wheel      1770  5 Mar 14:50 sddm.log
-rw-------   1 root  wheel        55  4 Mar 15:44 security
-rw-r-----   1 root  wheel       728 26 May 03:24 sendmail.st
-rw-r-----   1 root  wheel       728 20 May 18:00 sendmail.st.0
-rw-r-----   1 root  wheel       728 13 May 18:00 sendmail.st.1
-rw-r-----   1 root  wheel       728  6 May 18:00 sendmail.st.2
-rw-r-----   1 root  wheel       728 29 Apr 18:00 sendmail.st.3
-rw-r-----   1 root  wheel       728 22 Apr 18:00 sendmail.st.4
-rw-r-----   1 root  wheel       728 15 Apr 18:00 sendmail.st.5
-rw-r-----   1 root  wheel       728  8 Apr 18:00 sendmail.st.6
-rw-r-----   1 root  wheel       728  1 Apr 18:00 sendmail.st.7
-rw-r-----   1 root  wheel       728 25 Mar 17:00 sendmail.st.8
-rw-r-----   1 root  wheel       728 18 Mar 17:00 sendmail.st.9
-rw-------   1 root  wheel      5108 13 Mar 03:08 setuid.today
-rw-------   1 root  wheel      5010  5 Mar 03:07 setuid.yesterday
-rw-------   1 root  wheel      2131  5 Mar 01:14 userlog
-rw-r--r--   1 root  wheel       394 26 May 09:50 utx.lastlogin
-rw-r--r--   1 root  wheel      7986 26 May 09:50 utx.log
-rw-r--r--   1 root  wheel     11949  1 May 05:00 utx.log.0
-rw-r--r--   1 root  wheel     36561  1 Apr 05:00 utx.log.1
-rw-------   1 root  wheel        55  4 Mar 15:44 xferlog
-rw-r--r--   1 root  wheel     72224 26 May 09:50 Xorg.0.log
-rw-r--r--   1 root  wheel     89902 26 May 09:29 Xorg.0.log.old
-rw-r--r--   1 root  wheel     73216 10 Mar 04:45 Xorg.1.log
--More--(END)
 
Top