Welcome

Welcome, thanks to look my blog

Tuesday, 1 April 2014

how to import the database to mysql under linux?

  1. Connect to mysql database server
    $ mysql -uusername -ppassword
  2. Check database exists are not
    $ show databases;
  3. If not create the same
    mysql>create database mydb;
    note: mydb is database name(Give your own).
  4. Check again for the database follow step 2.
  5. exit
  6. Import data to mydb(your own) database
    $ mysql -uusername -ppassword mydb < bag.sql
    note: your bag.sql is in the current directory from where you are executing the above command
  7. Check for imported data.
YES FOR LONG WAIT YOU NEED TO CHECK YOUR BAG.SQL FILE SIZE.
Symbol '$' is shell prompt


Export database mysql:
# mysqldump -u root -ppassword database_name > File.sql
Dan untuk mengimportnya:
# mysql -u root -ppassword database_name < File.sql
Perintah yang cukup sederhana bukan?

No comments:

Post a Comment