Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2004
    Posts
    204

    Importing Multible Databases

    I'm trying import a .sql file into a linux server through SSH. The .sql has multiple databases inside of it. What would be the import statement for the file since the following could not work as it's create multible databases with the same username.

    mysql -u username -p database_name < dumpfile.sql

  2. #2
    Join Date
    Sep 2007
    Posts
    368

    *

    Quote Originally Posted by AustinS View Post
    I'm trying import a .sql file into a linux server through SSH. The .sql has multiple databases inside of it. What would be the import statement for the file since the following could not work as it's create multible databases with the same username.

    mysql -u username -p database_name < dumpfile.sql

    If create query is already present in sql file so you will import like that, below command will automatically create database as well and also import respectively all tables in related database.


    Code:
     
    
    mysql -u username -p  < dumpfile.sql

  3. #3
    Quote Originally Posted by nomankhn View Post
    If create query is already present in sql file so you will import like that, below command will automatically create database as well and also import respectively all tables in related database.


    Code:
     
    
    mysql -u username -p  < dumpfile.sql
    This is correct, the sql file has a section for all databases and tables within that database. It doesn't matter that the tables have the same name, it will be preserved between databases.

    Now if you are concerned about the user names that your applications use to connect to your different databases, that is handled by the users table, among others, in the mysql database and if your not importing those tables, then you will need to login to mysql and set the permissions to each database.

    Hope this helps.

  4. #4
    Join Date
    Oct 2004
    Posts
    204
    I'm getting an error with that:

    ERROR 1044 (42000) at line 12: Access denied for user 'database_db'@'localhost' to database 'database1'

    This is for a cpanel server.

  5. #5
    Join Date
    Sep 2007
    Posts
    368

    *

    Quote Originally Posted by AustinS View Post
    I'm getting an error with that:

    ERROR 1044 (42000) at line 12: Access denied for user 'database_db'@'localhost' to database 'database1'

    This is for a cpanel server.

    It means your credentials are not correct, please check username/password, if you have root access, import from that.

Similar Threads

  1. Multible Sites and Domains [For Sale]
    By Syphic in forum Other Offers & Requests
    Replies: 2
    Last Post: 12-11-2004, 10:57 PM
  2. Multible MySQL Table Select
    By Syphic in forum Programming Discussion
    Replies: 2
    Last Post: 12-10-2004, 12:33 AM
  3. Multible Domains
    By Syphic in forum Running a Web Hosting Business
    Replies: 3
    Last Post: 03-28-2004, 02:06 PM
  4. Importing from US to UK
    By SuperDon in forum Running a Web Hosting Business
    Replies: 8
    Last Post: 05-29-2003, 11:06 PM
  5. importing MySQL databases
    By ThePrimeHost in forum Dedicated Server
    Replies: 0
    Last Post: 04-11-2002, 07:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •