In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to export the database in mysql. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Several methods of exporting database by mysql
Method one
Cmd to the mysql bin directory with the following command mysqldump-- opt-h292.168.0.156-uusername-ppassword-- skip-lock-tables databasename > database.sql
Just change ip to localhost. Www.2cto.com.
If navicate is installed, it will be even easier to connect to the database first, select the database and then choose to dump sql.
Method two
Enter cmd (note that it is in os cmd rather than mysql)
=
1. Export database (sql script)
Mysqldump-u user name-p database name > exported file name
Mysqldump-u root-p db_name > test_db.sql
2.mysql exports a table from the database
Mysqldump-u user name-p database name table name > exported file name
Mysqldump-u wcnc-p test_db users > test_users.sql (no semicolon at the end)
Method three
Start the mysql service
/ etc/init.d/mysql start
Export the entire database
Mysqldump dbname > c:mydb.sql-u root-p
Import database
Source mydb.sql
Mysql-u user name-p database name
< 数据库名.sql 更详细的导入数据库教程 www.2cto.com 2.1. 导出sql脚本 在原数据库服务器上,可以用教程myadmin工具,或者mysqldump(mysqldump命令位于mysql/bin/目录中)命令行,导出sql脚本。 2.1.1 用phpmyadmin工具 导出选项中,选择导出"结构"和"数据",不要添加"drop database"和"drop table"选项。 选中"另存为文件"选项,如果数据比较多,可以选中"gzipped"选项。 将导出的sql文件保存下来。 2.1.2 用mysqldump命令行 命令格式 mysqldump -u用户名 -p 名 >Database name. Sql
Example:
Dump-uroot-p abc > abc.sql
(export database abc to abc.sql file)
When prompted for a password, enter the password for the database user name.
2.2. Create an empty database
Create a database through the main control interface / control panel. Suppose the database is named abc and the full user of the database is abc_f.
2.3. Import sql script into execution
There are also two methods, one using the phpmyadmin (my Management) tool, or the mysql command line.
2.3.1 use the phpmyadmin tool
From the control panel, select the empty database you created, and click manage to go to the management tools page.
In the "sql" menu, browse and select the sql file you just exported, and click execute to upload and execute.
Note: phpmyadmin has a limit on the size of the uploaded file, and php itself has a limit on the uploaded file size, if the original sql file
Larger, you can first use gzip to compress it, for text files such as sql files, you can get a compression ratio of 1:5 or higher.
How to use gzip: www.2cto.com
# gzip xxxxx.sql
Get
Xxxxx.sql.gz file.
2.3.2 use the mysql command line
Command format
Mysql-u user name-p database name < database name.sql
Example:
Mysql-uabc_f-p abc < abc.sql
(import database abc from abc.sql file)
When prompted for a password, enter the password for the database user name.
On how to export the database in mysql to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.