Eu tive que remover o mysql e reinstalá-lo, agora funciona
Eu tentei abrir o Mysql no Linux Ubuntu 16.04, mas recebi um erro:
ilqar@ubuntu:~$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Então eu tentei iniciar o servidor mysql:
ilqar@ubuntu:~$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
ilqar@ubuntu:~$ ^C
ilqar@ubuntu:~$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Sun 2018-01-21 10:39:04 +04; 17s ago
Process: 3620 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
ilqar@ubuntu:~$ journalctl -xe
--
-- Unit mysql.service has finished shutting down.
Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Jan 21 10:39:04 ubuntu mysql-systemd-start[3620]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Sou novato no Linux, por favor me ajude a descobrir o problema.
Eu tive que remover o mysql e reinstalá-lo, agora funciona
A mensagem de erro relevante é
MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
Tente executar
sudo mysqld --initialize
tente iniciar o serviço novamente.