Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The reason why Linux cannot find my.cnf after installing MySQL and how to recover the database from the sql statement file

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about the reasons why you can not find my.cnf after installing MySQL in Linux and how to restore the database from the sql statement file. Many people may not know much about it. In order to make you understand better, Xiaobian summarized the following content for you. I hope you can get something according to this article.

MySQL installed with the rpm package will not install the / etc/my.cnf file

As to why MySQL can start and function normally without this file, there are two theories here.

First, my.cnf is just a parameter file when MySQL starts. Without it, MySQL starts with the built-in default parameters.

Second, MySQL automatically uses the my-medium.cnf file in the / usr/share/ directory when it starts, which is limited to the MySQL installed by the rpm package

The solution is to copy a .cnf file from the / usr/share/mysql directory to the / etc directory and rename it my.cnf.

The file backed up with mysqldump is a SQL script that can be poured directly, and there are two ways to import the data.

Directly use the mysql client

For example:

/ usr/local/mysql/bin/mysql-uyejr-pyejr db_name < db_name.sql

Use SOURCE syntax

In fact, this is not a standard SQL syntax, but a feature provided by the mysql client, such as:

SOURCE / tmp/db_name.sql

You need to specify the absolute path to the file, and it must be a file that the mysqld running user (such as nobody) has permission to read.

After reading the above, do you have any further understanding of the reason why Linux cannot find my.cnf after installing MySQL and how to recover the database from the sql statement file? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report