[Solved] MYSQLD: Can‘t create directory ‘/usr/local/mysql/data/’(Errcode:2 -No such file or directory)

Detailed error information of MySQL version 5.7.31 startup

MySQL version   Mysql-5.7.31 initialization error information is shown in the figure below

The configuration file is correct   There’s no problem with the permissions of my.cnf configuration file. How can the default initialization still go to the/usr/local/MySQL directory

A complete solution   Specify basedir and dataDir again during initialization

mysqld –initialize –console –basedir=/usr/local/develop/mysql-5.7.31 –datadir=/usr/local/develop/mysql-5.7.31/data

So far, the problem has been solved   Successfully initialized

I’m sending you a question   But there will be problems when starting, as shown in the figure

This is a very special problem
A complete solution

./mysqld –user=root –basedir=/usr/local/develop/mysql-5.7.31 –datadir=/usr/local/develop/mysql-5.7.31/data

Be careful not to add start after the start command   Otherwise, it will prompt another error
As shown in the picture

After the start command is executed successfully, check whether MySQL exists

ps -ef |grep mysql


Read More: