MySQL import database fails - mysql

I have 2 MySQL databases 1_029f4ab_0 and 1_029f4ab_1
I want to copy the contents of 1_029f4ab_0 into 1_029f4ab_1
The structure of both databases are identical
I EXPORTED a WordPress database 1_029f4ab_0 and file was saved as localhost.sql to my laptop
In phpMyAdmin, I selected the second WordPress database 1_029f4ab_1 and chose "admin" in order to IMPORT the 1_029f4ab_0 database.
MySQL said: Documentation
#1044 - Access denied for user '1_029f4ab_1'#'localhost' to database '1_029f4ab_0'

Does your SQL file contain
CREATE DATABASE 1_029f4ab_0;
or
USE 1_029f4ab_0;
If so, delete those lines and re-run it. If you export the database from the top level in PHPmyadmin then sometimes it can add that in

Related

How to copy table from a database on SERVER 1 to another database on SERVER 2 using phpMyAdmin?

I have a database named db_x on server X (running WHM) and another database named db_y on server Y. I connected to server X via SSH made some changes to the phpmyadmin configurations to allow it to connect to db_y via phpmyadmin on server X via cPanel. Now, I want to move all the tables of the db_x on server_X to another database(db_y) which is on different server(yy.yy.yy.yy) by using phpMyAdmin from server_X.
Is there any way to do so? Please help me.
Edit: The table is over 3 GB, so export/import won't work.
due to the size of your database you will not be able to succeed with phpmyadmin.
Try use the SSH.
Upload the database to the new server "old_database.sql".
Considering that the database already existis on the new server, use the command below:
# mysql new_database < old_database.sql
This command will import your sql file into the new database.
If you don't have the old_database.sql file, you can also obtain it with command in old server
# mysqldump mydatabase > old_database.sql
This command will generate an SQL file from your database.
Ther will be an option export in db_x export it and in db_y click import
and chose downloaded file wich was exported and click run.

Connecting to MySQL database on AWS server from PHPMyAdmin

I am trying to connect to a MySQL database that resides on an AWS server from within PHPMyAdmin, to be able to view its tables.
I have the connection strings (hostname, username, password), but I do not see where I would link or provide the AWS database parameters.
Ultimately what I would like to do with the tables is to use the data in my front-end userform that is created in MS Excel.
Here's what I am able to do successfully:
1. can create MySQL database (testdb)
2. can create a table (testtable) from PHPMyAdmin
3. Use the MySQL for Excel connection service to be able to connect to the testtable in the testdb and use the data in my Excel application.
The problem I am having is bringing or linking to the MySQL database on the AWS server to my testdb. I just want to be able to see a list of the AWS database tables in Phpmyadmin. Is that possible?
Yes, it is possible. You can edit config.inc.php file of phpmyadmin to add as many servers as you want
Here is the link with the guide
https://tecadmin.net/add-multiple-hosts-in-phpmyadmin/

phpmyadmin - localhost.sql import - #1046 - No database selected

I have an old backup of some localhost databases (localhost.sql), which needs to be imported into PhPMyAdmin on a Windows 7 machine with XAMPP installed.
When I try to import localhost.sql (containing multiple databases) in PhPMyAdmin, I get the following error:
#1046 - No database selected
With a single database, you would simply create a new database with the same name and import to that. As this is an old backup, I am not able to recreate the export and I also donĀ“t know the database names that are inside localhost.sql.
Is there a way to recover this?
You have two possibilities to do this :
Create all the databases by hand in phpMyAdmin. Split your .sql file so that each file corresponds to a database. And finally you import each file in the correct database.
Edit your localhost.sql file and add the commands to create the databases ("CREATE DATABASE ...") in the right place. Then you import all at once.

Migrate MySql Database To New Server

I have done an export of my database to an .sql file.
When I try and upload this to my new server it comes up as access denied for user 'username' # '%'
The original database is called 'originalUsername_databaseName' where as it appears that the new server requires the prefix 'admin_'
I am convinced that it is the database name that is causing the error. Is there a way to change this ?
Make sure that your sql file does not contain CREATE DATABASE and USE statements.
If it does, remove them.
Create database manually and import tables to it.

how to change the username of a mysql database?

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:
1. Select the database you want to import into (or create a new one).
2. Click on SQL tab at the top.
3. Click "browse" next to the file upload box and select your sql file.
4. Click go to start the import.
UPDATE: Regarding your update showing the error message. It is trying to import the sql into a database named db-server-A on server B. Open the sql file in a text editor, and replace all instances of db-server-A with the name of your database on server B. Then save and repeat the steps above.
Can you change the access details in the wp config file for the new server:
wp-config.php