mysql import and export database data table method

  • 2020-06-07 05:25:03
  • OfStack

Under the Linux
All operate under the control.
Import database:
Prerequisite: Database and data table must exist (already created)

(1) Import the data table test_user.sql into the test_user table of test database
[root@test ~]# mysql -uroot -p test < /www/web/test/test_user.sql

(2) Import database ES19en. sql into test database test
[root@test ~]# mysql -uroot -p test < /www/web/test/test.sql

(3)source command is not in the console, so enter mysql for operation
mysql > use test;
mysql > source /www/web/test/test.sql

Export database:

(1) the database test export to/www/web/test/test sql
[root@test ~]# mysqldump -uroot -p test > /www/web/test/test.sql
Prompt for password when you enter

(2) the database test user data tables in export to/www/web/test/user sql
[root@test ~]# mysqldump -uroot -p test user < /www/web/test/user.sql


Related articles: