How to export and import the databases in MySql.
phpMyAdmin shows an error during importing the exported .sql file. It gives message like this SQL query:
--
-- Database: mcadatabase
--
-- Table structure for table trick
CREATE TABLE IF NOT EXISTS trick
( id
int(5) unsigned NOT NULL, question
varchar(20000) NOT NULL, option1
varchar(200) NOT NULL, option2
varchar(200) NOT NULL, option3
varchar(200) NOT NULL, option4Right
varchar(200) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; MySQL said: Documentation
1046 - No database selected
With phpMyAdmin, you need to create a database named mcadatabase
. Then, select this database and select Import
.
Use command Line to import/export database
Import:
Export:
For Exporting open a terminal :-
mysql -u root -p your_database_name > any_file_name.sql
For Importing:-
mysql -u root -p < sql_file_name.sql
For exporting only a table in your database:-
mysql -u root -p your_database_name your_table_name > any_file_name.sql
Importing a table remains same as above.
Hope this helps!
链接地址: http://www.djcxy.com/p/63892.html上一篇: 缓慢的MySQL查询,按限制排序
下一篇: 如何在MySql中导出和导入数据库。