MySql common errors and solutions

As one of the most popular databases, MySql has a very high usage rate. You will encounter many problems during use. This article records the problems encountered. For MySql installation, please refer to another document "Non-installation version of MySql " Install"

1、Can't create/write to file 'F: ools\MySql\mysql-5.7.38-winx64\data\is_writable

At the beginning, the file paths of basedir and datadir were as follows:

# 自定义设置mysql的安装目录,即解压mysql压缩包的目录
basedir=F:\tools\MySql\mysql-5.7.38-winx64
 
# 自定义设置mysql数据库的数据存放目录
datadir=F:\tools\MySql\mysql-5.7.38-winx64\data

The result prompts that the creation failed, prompting: Can't create/write to file 'F: ools\MySql\mysql-5.7.38-winx64\data\is_writable

F:\tools\MySql\mysql-5.7.38-winx64\bin>mysqld --initialize --user=mysql --console
mysqld: Can't create/write to file 'F:  ools\MySql\mysql-5.7.38-winx64\data\is_writable' (Errcode: 2 - No such file or directory)
2022-08-04T14:56:12.551705Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-08-04T14:56:12.552375Z 0 [ERROR] Can't find error-message file 'F:\tools\MySql\mysql-5.7.38-winx64\bin\    ools\MySql\mysql-5.7.38-winx64\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2022-08-04T14:56:12.554216Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2022-08-04T14:56:12.554652Z 0 [ERROR] Aborting

 At first I thought it was a problem with DOS window permissions, but later I changed it to run with administrator permissions and the problem still persisted. After careful inspection, I found that the \ behind the drive letter in the prompt information was gone, and I suspected that it might be a problem with the separator. Just change it to /.

2. When logging in, it prompts that the file cannot be found.

If the generated temporary password contains <, then congratulations on winning the prize. The password I generated when I generated it for the first time contained this character. The login prompt was that the file could not be found. I had no choice but to delete the data directory and start the installation again.

3. The service does not report any errors.

I have found many methods online, but they all require reinstalling MySql.

C:\WINDOWS\system32>net start mysql5.7
MySQL5.7 服务正在启动 .
MySQL5.7 服务无法启动。

服务没有报告任何错误。

请键入 NET HELPMSG 3534 以获得更多的帮助。

4. System error 5 occurred.

Please run the DOS window with administrative rights

C:\Users\ydecai>net start mysql5.7
发生系统错误 5。

拒绝访问。

5、mysql: [ERROR] unknown variable 'sql_mode=...

Please use mysqld to install the mysql service

F:\tools\MySql\mysql-5.7.38-winx64\bin>mysql --install MySql5.7
mysql: [ERROR] unknown variable 'sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'

6、this is incompatible with sql_mode=only_full_group_by

Add a configuration sentence under [mysqld] (not the end of the file!!!), and modify it if it already exists.

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

7、Operating system error number 5 in a file operation.

2023-06-14T14:46:27.359530Z 0 [ERROR] InnoDB: Operating system error number 5 in a file operation.
2023-06-14T14:46:27.359912Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. It may also be you have created a subdirectory of the same name as a data file.
2023-06-14 22:46:27 0x14d8  InnoDB: Assertion failure in thread 5336 in file fil0fil.cc line 922

 After the mysql data storage directory was modified, the startup prompt was 1067 error. After checking the log, it was found that the permissions were insufficient. The permissions for mysql to create files use NET SERVICE, just add the corresponding permissions.

 

Guess you like

Origin blog.csdn.net/caicaimaomao/article/details/126168599