Solved Can't start MySQL / MariaDB

Hi :),

I can't start start MariaDB for some reason...

If I want to log in with this command mysql -u root -p.... I get this output:

Code:
root@server# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I also tried to start it manually with mysqld_safe and mysqld

And I also tried to reinstall mariadb (binary and source) but with no success...

Maybe someone has the same problem or knows the solution to this problem.

thank you in advance
:)
 
Use service mysql-server start to start it. If it's the first time the startup scripts will automatically create the required MySQL tables in /var/db/mysql/ (assuming you didn't change mysql_dbdir).

Make sure /var/db/mysql is owned by the mysql user. If this is the first time you're starting it make sure that directory is completely empty.
 
I ran service mysql-server start, but when I checked with service mysql-server status I got this output
Code:
root@server:~ # service mysql-server status
mysql is not running.

Permissions / ownership of the /var/db/mysql/ directory.
ls -l /var/db/ | grep mysql

Code:
drwxr-xr-x   5 mysql     mysql          14 Jun 19 18:00 mysql

These files were inside the /var/db/mysql/ directory, so I deleted them and ran again the service mysql-server start command, but it still doesn't want to start...

Code:
root@server:~ # ls -l /var/db/mysql/
total 878
-rw-rw----  1 mysql  mysql     16384 Jun 19 18:00 aria_log.00000001
-rw-rw----  1 mysql  mysql        52 Jun 19 18:00 aria_log_control
-rw-rw----  1 mysql  mysql    157203 Jun 19 18:00 server.err
-rw-r-----  1 mysql  mysql       942 Jun 19 18:00 ib_buffer_pool
-rw-rw----  1 mysql  mysql  50331648 Jun 19 18:00 ib_logfile0
-rw-rw----  1 mysql  mysql  50331648 Jun 17 18:43 ib_logfile1
-rw-rw----  1 mysql  mysql  12582912 Jun 19 18:00 ibdata1
-rw-rw----  1 mysql  mysql         0 Jun 17 18:43 multi-master.info
-rw-r--r--  1 root   mysql         0 Jun 18 20:34 my.cnf
drwx------  2 mysql  mysql        89 Jun 17 18:43 mysql
drwx------  2 mysql  mysql         3 Jun 18 16:33 nextcloud
drwx------  2 mysql  mysql         3 Jun 17 18:43 performance_schema
root@server:~ # rm -rf /var/db/mysql/*
root@server:~ # ls -l /var/db/mysql/
total 0
 
Try again, if it fails look in /var/db/mysql/server.err to see what errors you encountered.
 
  • Thanks
Reactions: jdb
Output of cat /var/db/mysql/server.err

Code:
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Uses event mutexes
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Number of pools: 1
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Using SSE2 crc32 instructions
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Completed initialization of buffer pool
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-20 14:43:07 34431139840 [Note] InnoDB: 128 out of 128 rollback segments are active.
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-06-20 14:43:07 34431139840 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-06-20 14:43:07 34431139840 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-06-20 14:43:07 34431139840 [Note] InnoDB: 5.7.22 started; log sequence number 1620025
2018-06-20 14:43:07 34737139968 [Note] InnoDB: Loading buffer pool(s) from /var/db/mysql/ib_buffer_pool
2018-06-20 14:43:07 34737139968 [Note] InnoDB: Buffer pool(s) load completed at 180620 14:43:07
2018-06-20 14:43:07 34431139840 [Note] Plugin 'FEEDBACK' is disabled.
2018-06-20 14:43:07 34431139840 [ERROR] Can't create IP socket: hostname nor servname provided, or not known
2018-06-20 14:43:07 34431139840 [ERROR] Aborting
 
This is the reason why it's not starting:
Code:
2018-06-20 14:43:07 34431139840 [ERROR] Can't create IP socket: hostname nor servname provided, or not known

I don't really understand why though, even if the host doesn't have a network it should still bind to 127.0.0.1. Is this running in a jail? Are you using a custom my.cnf?
 
This is the reason why it's not starting:
Code:
2018-06-20 14:43:07 34431139840 [ERROR] Can't create IP socket: hostname nor servname provided, or not known

I don't really understand why though, even if the host doesn't have a network it should still bind to 127.0.0.1. Is this running in a jail? Are you using a custom my.cnf?

I thought the same...

Now I have found the error. It was a typo in the /etc/rc.conf file.

I checked if the mysql_args were set correctly, then I found the typo :) (in the /etc/rc.conf file).

Code:
Before: mysql_args="--bind-address=127.0.0.1."
After:  mysql_args="--bind-address=127.0.0.1"

Now I starts perfectly fine ;)

Code:
root@server:~ # service mysql-server start
Starting mysql.
root@server:~ # service mysql-server status
mysql is running as pid 31900.
root@server:~ #
 
Back
Top