Use mysql commands in CentOS to import and export. SQL data
Recently, I was transferring data from the site. When I backed up the database, I found that the database was too large. I tried to upload phpmyadmin, but the success rate was not high. Many data tables were not completely restored, however, you can only use command lines to import data.
System Environment centos 6.5 64-bit, php + mysql Environment
Backup:
1. Enter the Bin directory under MySql, for example:
Cd/usr/local/mysql/bin2. basic backup. /mysqldump-uroot-proot mydb> backup. SQL Note: mydb is the name of the database to be backed up. the database username and password are both root; the backup result is saved in the current directory for backup. SQLRestore:
1. log on to the system through SSH and log on to mysql DATA
# Mysql-u root-p # Note-p is to use the password to log on. Here, all logon attempts are mysql account and password # enter the password and enter it to log on to mysql>
2. Select a database
# Mysql> use database_name # Replace database_name with the database to be restored
3. Select the backup. SQL file to start importing.
# Mysql> source/root/backup-20140807. SQL # select the backup data corresponding path to complete
4. The data restoration result prompts that the process is complete.
If there is an exception in the restore result, follow the prompts to solve the problem.