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

Linux system how to import sql file method linux import sql file command code

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Computer Software News >

Share

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

Linux import sql file command to share with you, many users have just come into contact with the linux system, and Windows is completely different from the use of computers, do you feel a headache?

Upload sql files

As mentioned earlier, we have not installed ftp on the CVM, how can we upload it?

Open ftp client software, such as filezilla, and use the server IP and root and password. Be sure to connect in SFTP mode when connecting, so that you can connect to linux. Note that this method is not secure, but we do not have ftp here, and there is no better and faster way to upload local files to the server.

We upload database.sql to the / tmp directory.

Connect to linux and log in to mysql

Use putty to connect to the cloud host. The use of putty will not be introduced here.

After connecting, log in to mysql

The code is as follows:

> mysql-u root-p

> password:

Note that if you have previously established other mysql users, you can choose the appropriate user to log in. You can learn about the command line of mysql elsewhere.

Import the uploaded sql into the database

Follow these three steps to quickly import the sql file

The code is as follows:

Mysql > use yourdatabasename

Mysql > set names utf8

Mysql > source / tmp/database.sql

Then the screen will keep scrolling, and finally prompt that the import is successful.

Finally, remember to delete the database.sql.

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

Computer Software News

Wechat

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

12
Report