You can import a MySQL script (or .sql) file into MySQL server using
- Unix / Linux shell prompt.
- phpMyAdmin web based gui tool.
Unix / Linux shell prompt example
Copy a .sql file to a remote server using sftp or scp client:
$ scp foo.sql vivek@serer1.cyberciti.biz:~/
Login into a remote server using ssh client:
$ ssh vivek@server1.cyberciti.biz
Type the following command to import a .sql file:
mysql -u USERNAME -p -h localhost YOUR-DATA-BASE-NAME-HERE < YOUR-.SQL.FILE-NAME-HERE
In this example, import a 'foo.sql' file into 'bar' database using vivek as username:
mysql -u vivek -p -h localhost bar < foo.sql
phpMyAdmin
Login to phpMyAdmin. Open a web-browser and type phpMyAdmin url:
http://server1.cyberciti.biz/phpmyadmin/
In phpMyAdmin, choose the database you intend to work with from the database menu list (located on the left side).
phpMyAdmin Database Selection
Choose the IMPORT tab > Click on Browse your computer "Choose file" > Select file > Choose Ok > Choose Go
No comments:
Post a Comment