Home >Operation and Maintenance >Linux Operation and Maintenance >What to do if linux mysqld cannot start

What to do if linux mysqld cannot start

藏色散人
藏色散人Original
2023-03-07 09:13:193773browse

Solution to the problem that linux mysqld cannot start: 1. Install mysql through the "yum install mysql-server" command; 2. Open "my.cnf", and then add a line "skip-" under "[mysqld]" grant-tables"; 3. Restart mysql through "systemctl restart mysqld".

What to do if linux mysqld cannot start

The operating environment of this tutorial: linux5.9.8 system, mysql version 5.7, DELL G3 computer

What to do if linux mysqld cannot start ?

Common solutions to mysql installation failure and startup failure in Linux

##1. Mysql failed to start after installation

  • Use the command

    systemctl start mysqld.service

  • An error occurred :Unit mysql.service could not be found

  • Issues a question whether mysql is installed successfully, use the command to find

    find / -name mysql

  • It is found that the /usr/bin/mysql directory does not exist, indicating that the installation failed.

    Then use yum to install mysql

1.1 Solve the problem that the public key has not been installed when installing Centos7 yum

Installation command

yum install mysql-server
The following problems occur during installation. GPG security issues:

What to do if linux mysqld cannot start

Add --nogpgcheck after the yum install xxxx command to skip the public key check installation, solve the problem, and the installation is successful!


What to do if linux mysqld cannot start

2. First time login without password

2.1 Enter mysqld.log

cat /var/log/mysqld.log | grep 'root@localhost:'
2.2 Find this line of log, password: a#sE2lVHzzvV

2022-05-13T02:35:13.846556Z 1 [Note] A temporary password is generated for root@localhost: a#sE2lVHzzvV

If the connection is still refused, try skipping the password to enter: enter vim /etc/my.cnf and add a line under [mysqld]skip-grant -tables is used to skip the password verification process, and then restart mysql systemctl restart mysqld, and then enter the command mysql to enter. After changing the password, you can remove this line Configure and then reboot.

2.3 After logging in to refresh the permissions, the password is changed to: 1234

flush privileges;
alter user root@localhost identified by '1234';
2.4 An error occurs (the password is too simple

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Re-change the password to: Han123…

alter user root@localhost identified by 'Han123..' # mysql5.7 ,若失败可以将root@localhost替换root@%试试
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Han123..'; # mysql8.0,若失败可以将'root'@'localhost'替换'root'@'%'试试
Recommended study: "Linux Video Tutorial"

The above is the detailed content of What to do if linux mysqld cannot start. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn