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

How to run sql files in the background of mysql server

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to run sql files in mysql server background", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn how to run sql files in mysql server background.

Recently, a large amount of test data has to be generated in batches. I wrote a mysql file. Because it takes too long to execute this sql file, you need to execute this script in the background on the mysql server.

Prepare SQL files.

My sql file name is full.sql and the contents are sql statements. For example:

INSERT INTO `xnm`.` role` (`id`, `name`, `description`, `create_time`, `update_time`) VALUES ('1 ', 'GUEST', ' Visitor ', '2017-10-20 17:09: 38','2017-10-20 17:09: 41'); II. Shell script to be executed.

My script file name is import.sh and it reads as follows: exit after executing full.sql:

mysql -u root --password= your password--database= your database./ mysql_output.log 2>&1 &

ps aux after running| grep mysql Make sure the script is running in the background.

Exit xshell.

After nohup is executed, the terminal must exit normally in exit mode. If you exit directly, some hosts will think that you exit abnormally and close your process.

Reconnect to the server and confirm that the script is running.

Reconnect the server with ps aux| grep mysql Make sure the script is running in the background.

At this point, I believe that we have a deeper understanding of "mysql server background how to run sql files," may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

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

Internet Technology

Wechat

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

12
Report