简体   繁体   中英

How can I add a new user to a MySQL db from another hosting provider?

I have a MySQL database from hosting company B. I am trying to get it hosted onto my personal hosting platform, company A.

Company A has a maximum SQL upload filesize limit of 50 megabytes. So I am using SSH.

Now the prefix for names from company B's hosting situation is 'videoga2_'. The prefix for names from Company A's hosting situation is 'adrianr1_'.

I am logged into company B's hosting setup with SSH and am trying to run the following, so my client can see the site I've been building for them (it's a WordPress site).

   mysql -uvg2_adrianRosales -p adrianr1_vgChooChoo < vgcc.sql;

and I get the response:

Access denied for user 'vg2_adrianRosales'@'localhost' (using password: YES)

Which makes sense because my login for SSH on Company B is 'adrianr1_manual'.

If I, instead try:

   mysql -uadrianr1_manual -p adrianr1_vgChooChoo < vgcc.sql;

Then it doesn't work because:

   Access denied for user 'adrianr1_manual'@'localhost' to database 'videoga2_chooch'

'videoga2_chooch' is the name of the database inside vgcc.sql.

So what I'm trying to figure out is...how can I add adrianr1_manual to 'videoga2_chooch' ((I've tried on the hosting site and then exporting the sql file, but it forces all names to be prefixed with 'videoga2_'))

OR

How can I create an ssh user on Company B that matches a priveleged user on Company A?

Please help me.

Your adrianr1_manual user need the right permission to create a new database. See the note from 3.3.1 Creating and Selecting a Database :

Note

If you get an error such as ERROR 1044 (42000): Access denied for user 'micah'@'localhost' to database 'menagerie' when attempting to create a database, this means that your user account does not have the necessary privileges to do so. Discuss this with the administrator or see Section 6.2, “Access Control and Account Management”.

If you don't want to create a new database but use an existing one you can build the mysql dump with the --no-create-db argument, see mysqldump with create database line .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM