This may be a basic problem in the database world but I don’t speak ‘databaseian’ fluently.
I am transferring a website from one hosting service to another; from server A to server B. Server B offers the service of transfer but I would like to do it myself. The website is based on WordPress.
My strategy is:
- to copy all the files from one server (A) to the other one (B) (done).
- to export the mysql database from server A into a .sql file (done).
- import the .sql file into a new database in server B so now WordPress can talk to MySql (here is the problem).
The hosting service in server B provides the phpMyAdmin where I can import a .sql file ,the problem is that the database in server A was using a particular username (defined by them) and server B has another one (which I cannot change).
Is there a way of editing the .sql file in order to change (add) the username to the one in server B so I can import it smoothly?
Note: I have the password for the .sql database and username as well.
Update: The error shown by phpMyadmin when trying to import the .sql file is:
#1044 - Access denied for user 'userServerB'@'localhost' to database 'db-server-A'
Many Thanks
UPDATE: Everything is working now. Apparently the .sql file had a line that was trying to create a new database itself. I got rid of this line and just used a pre-created database using all the rest of the .sql file and voila. Particular thanks to @daking963
The database username/password is not part of the dumped database sql. It is part of the connection authentication details. You used one username/password to connect to server A, and a different one to connect to server B. The sql file is independent of this.
So, first just log in to phpMyAdmin on server B using the username/password they provided. Then, import the sql by following these steps:
UPDATE: Regarding your update showing the error message. It is trying to import the sql into a database named
db-server-Aon server B. Open the sql file in a text editor, and replace all instances ofdb-server-Awith the name of your database on server B. Then save and repeat the steps above.