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 import sql data from the Mysql command line

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

How to import sql data from the Mysql command line? for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a simpler and easier way.

How to import sql data from Mysql command line

My personal practice is: phpmyadmin exports abc.sql of utf-8 's insert schema

Ftpabc.sql to server

Ssh to server

Mysql-uabc-p

UseKKK (database name, if not createdatabaseKKK)

Setnames'utf8'

Sourceabc.sql

Note: I saw what setcharactersetutf8; said, that won't work, the Chinese code is garbled.

How to import sql data from Mysql command line

1. First open mysql in the command line console

Perhaps the command is as follows:

Mysql-uroot-pdatabase_name

Then you may be prompted for the corresponding password.

two。 The following command may be useful to you when you want to change a database

Mysql > usedatabase_name

Then use the following command

Mysql > sourced:\ datafilename.sql

Of course, you need to figure out the path of the file and use it correctly.

Enter the subdirectory of the directory where the mysql installation is located, bin. Exe. Enter the command to execute the import sql.

For example, your mysql is installed in d:\ mysql

The steps are as follows:

Start-> run-> enter CMD

D:

Cdmysql\ bin

Mysql-uroot-p123456test

Where root is your mysql administrator user name, 123456 is the password test is the database name d:\ a.sql is the location of the backed up data file.

If Windows, from the command prompt to the Bin folder in the MYSQL file directory, execute the command

Mysql-uroot-pdatabasename

Where root is your MYSQL user name, databasename is the name of your database, and db.sql you are the file. Note that you must put db.sql under the bin folder. Of course, the location of the file can be changed.

If it is LINUX, enter it directly.

Mysqldatabasename

It's OK. The default mysql command is system command.

This is the answer to the question about how to import sql data from the Mysql command line. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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