In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces you how to import and export mysql database in Linux, the content is very detailed, interested friends can refer to it, I hope it can help you.
Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.
1. Export database with mysqldump command
(Note: first cd to mysql run path, and then execute a command):
1. Export data and table structure:
mysqldump -u username-p password database name> database name.sql
Note that my server configuration permissions are special, so I need to use muysqldump -h 127.0.0.1-u username-p password database name> database name you named yourself.sql
mysqldump -uroot -p dbname > dbname .sqlmysqldump -h 127.0.0.1 -uroot -p dbname > dbname .sql
After exporting, you can log in to ftp and find this sql file and download it directly, or download it with scp command.
Enter will prompt for password
2. Export only table structure
mysqldump -u username-p password-d database name> database name.sql
For example: mysqldump -uroot -p -d dbname > dbname.sql
II. Import database
First, create an empty database.
mysql>create database dbname ;
2. Import database
Method 1:
(1) Select database
mysql>use dbname ; e.g. mysql>use hljz
(2) Set database code
mysql>set names utf8;
(3) Import data (note the path of sql file)
mysql>source /home/xxxx/dbname .sql; /home/xxxx/dbname.sql is the path of your database file on the server. How to import and export mysql database in Linux is shared here. I hope the above content can be of some help to everyone. You can learn more. If you think the article is good, you can share it so that more people can see 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.
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.