Get the App
SLTechnology News&Howtos  ›  Database  › 

How to solve the problem that you can't start MySQL with root account

Shulou Source: shulou.com Published: 2022-06-01 17:39:32 10月05日 Update

How to solve the problem that I can't start MySQL with my root account? I believe that many inexperienced people are at a loss about this. This article summarizes the solution to the problem of not starting MySQL with a root account. Through this article, I hope you can solve this problem.

Scene

Version 5.6.44, [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root! Here, mysql refuses to start the mysql service with the root account by default for security reasons.

Solve

1. Start by forcing the use of a root account by adding-user=root to the command

Mysqld-user=root

two。 Start mysqld with a normal user. This user must belong to the mysqld user group and be in the my.cnf file. Use vi / etc/my.cnf

Add user=mysql to specify mysql users to start the mysql service, or add user=root directly

[set permissions]

Use the following command to see if there are any mysql users and user groups

$cat / etc/passwd # View user list

$cat / etc/group # View the list of user groups

If not, create it.

$groupadd mysql

$useradd-g mysql mysql

Modify / usr/local/mysqld permissions

$chown-R mysql:mysql / usr/local/mysqld

The above is the solution to the problem that you can't start MySQL with your root account, and you have to use it before you know the details. If you want to read more related articles, you are welcome to follow the industry information channel!

Tags: Users accounts questions user groups methods commands permissions articles services normal security helpless content scenarios for this that is situations files articles more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS NVidia Shulou Information Shulou Tech Info Redmi