[RISOLTO] Impossibile avviare il server MySQL

Salve ragazzi,
per un progetto dell’università ho bisogno di un server mysql sul mio pc. Ho installato sia il client sia il server mysql tramite YUM,

# yum install mysql mysql-server

FIn qui tutto bene. Quando però provo ad avviare il servizio di mysql, mi esce questo errore:

# systemctl start mysqld Job failed. See system journal and 'systemctl status' for details.

Ecco i due report dell’errore:

[code]# systemctl status mysqld
mysqld.service - MySQL database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled)
Active: failed (Result: exit-code) since Mon, 23 Sep 2013 15:16:24 +0200; 52s ago
Process: 7199 ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 7198 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 7176 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir %n (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/mysqld.service

Sep 23 15:16:21 Samsung mysqld_safe[7198]: 130923 15:16:21 mysqld_safe Logging to ‘/var/log/mysqld.log’.
Sep 23 15:16:21 Samsung mysqld_safe[7198]: 130923 15:16:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[/code]

# systemd-journalctl | grep mysql Sep 23 15:14:02 Samsung mysqld_safe[6878]: 130923 15:14:02 mysqld_safe Loggi.... Sep 23 15:14:02 Samsung mysqld_safe[6878]: 130923 15:14:02 mysqld_safe Start...l Sep 23 15:14:05 Samsung mysqld_safe[6878]: 130923 15:14:05 mysqld_safe mysql...d Sep 23 15:14:06 Samsung systemd[1]: mysqld.service: control process exited,...=1 Sep 23 15:14:06 Samsung systemd[1]: Unit mysqld.service entered failed state. Sep 23 15:15:50 Samsung yum[7120]: Installed: mysql-libs-5.5.32-1.fc17.x86_64 Sep 23 15:15:53 Samsung yum[7120]: Installed: mysql-5.5.32-1.fc17.x86_64 Sep 23 15:15:54 Samsung useradd[7140]: failed adding user 'mysql', data deleted Sep 23 15:15:57 Samsung yum[7120]: Installed: mysql-server-5.5.32-1.fc17.x86_64 Sep 23 15:16:21 Samsung mysqld_safe[7198]: 130923 15:16:21 mysqld_safe Loggi.... Sep 23 15:16:21 Samsung mysqld_safe[7198]: 130923 15:16:21 mysqld_safe Start...l Sep 23 15:16:23 Samsung mysqld_safe[7198]: 130923 15:16:23 mysqld_safe mysql...d Sep 23 15:16:24 Samsung systemd[1]: mysqld.service: control process exited,...=1 Sep 23 15:16:24 Samsung systemd[1]: Unit mysqld.service entered failed state.

Grazie in anticipo per l’aiuto ! :wink:

Possiamo vedere anche il log?

# gedit /var/log/mysqld.log

[root@Samsung mekko]# cat /var/log/mysqld.log 130923 15:16:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 130923 15:16:21 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 130923 15:16:21 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 130923 15:16:21 InnoDB: The InnoDB memory heap is disabled 130923 15:16:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins 130923 15:16:21 InnoDB: Compressed tables use zlib 1.2.5 130923 15:16:21 InnoDB: Using Linux native AIO 130923 15:16:21 InnoDB: Initializing buffer pool, size = 128.0M 130923 15:16:21 InnoDB: Completed initialization of buffer pool 130923 15:16:21 InnoDB: highest supported file format is Barracuda. InnoDB: Log scan progressed past the checkpoint lsn 49439 130923 15:16:21 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 1596889 130923 15:16:21 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 130923 15:16:22 InnoDB: Waiting for the background threads to start 130923 15:16:23 InnoDB: 5.5.32 started; log sequence number 1596889 130923 15:16:23 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 130923 15:16:23 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 130923 15:16:23 [Note] Server socket created on IP: '0.0.0.0'. 130923 15:16:23 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13) 130923 15:16:23 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13) 130923 15:16:23 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 130923 15:21:04 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 130923 15:21:04 [Note] Plugin 'FEDERATED' is disabled. /usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 130923 15:21:04 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 130923 15:21:04 InnoDB: The InnoDB memory heap is disabled 130923 15:21:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins 130923 15:21:04 InnoDB: Compressed tables use zlib 1.2.5 130923 15:21:04 InnoDB: Using Linux native AIO 130923 15:21:04 InnoDB: Initializing buffer pool, size = 128.0M 130923 15:21:04 InnoDB: Completed initialization of buffer pool 130923 15:21:04 InnoDB: highest supported file format is Barracuda. InnoDB: Log scan progressed past the checkpoint lsn 49439 130923 15:21:04 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 1596889 130923 15:21:04 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 130923 15:21:05 InnoDB: Waiting for the background threads to start 130923 15:21:06 InnoDB: 5.5.32 started; log sequence number 1596889 130923 15:21:06 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 130923 15:21:06 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 130923 15:21:06 [Note] Server socket created on IP: '0.0.0.0'. 130923 15:21:06 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13) 130923 15:21:06 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13) 130923 15:21:06 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Prova a fargli ricreare il file di configurazione. Ferma comunque mysqld e poi:

# rm /etc/mysql/my.cnf

Riavvia il servizio o fai ripartire la macchina. Se non funziona vediamo i permessi:

# ll /var/lib/mysql/

Sembra che ora i files di configurazione siano in /etc/my.cnf.d.
Io comincerei dalla seconda (il proprietario di /var/lib/mysql deve essere mysql, gruppo mysql).
Inoltre controllerei

$ cat /etc/hosts

per verificare che localhost sia correttamente associato a 127.0.0.1.

Provato la procedura suggerita da robyduck ma niente, sempre lo stesso errore quando provo ad avviare il servizio

[root@Samsung mekko]# systemctl stop mysqld
[root@Samsung mekko]# rm /etc/my.cnf 
rm: rimuovere file regolare "/etc/my.cnf"? s
[root@Samsung mekko]# systemctl start mysqld
Job failed. See system journal and 'systemctl status' for details.[/code]

[code][root@Samsung mekko]# ll /var/lib/mysql/
totale 28700
-rw-rw----. 1 mysql mysql     8192 23 set 15.14 aria_log.00000001
-rw-rw----. 1 mysql mysql       52 23 set 15.14 aria_log_control
-rw-rw----. 1 mysql mysql 18874368 25 set 13.33 ibdata1
-rw-rw----. 1 mysql mysql  5242880 25 set 13.33 ib_logfile0
-rw-rw----. 1 mysql mysql  5242880 22 set 16.00 ib_logfile1
drwx------. 2 root  root      4096 22 set 15.59 mysql
drwx------. 2 root  root      4096 22 set 16.19 performance_schema
-rw-r-----. 1 mysql mysql     2105 25 set 13.33 Samsung.err
drwx------. 2 root  root      4096 22 set 15.58 test

Per rispondere a marcomotta invece:

[mekko@Samsung ~]$ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

Grazie per l’aiuto :wink:

Vedi che il proprietario e il gruppo di alcune cartelle è root? Deve essere mysql:

# chown -R mysql:mysql /var/lib/mysql

Grazie risolto !!
Era quello il problema ! :smiley:

Avevo avuto il sospetto che il problema fosse quello, perché tempo fa avevo avuto lo stesso problema (le vecchie versioni di mysql evidentemente non prevedevano un utente mysql).

ciao a tutti,
vorrei ringraziare in maniera “infinita” marcomotta: grazie al suo suggerimento ho risolto il problema di mysqld.

p.s.
googlolando a destra e a manca nessuno riusciva a darmi la soluzione.
solo questo forum mi ha dato la dritta giusta