1

New to MySQL user so pardon the relative beginner question. I've been searching for an answer to this for the past few hours but just can't figure it out!

I'm trying to import a backup of a wordpress database to a new GCP instance with mySQL. I've copied the .sql file to the server & I've typed the import command as follows:

mysql - u root -p databasename < databasefile.sql 

The problem however is that SQL returns no message at all, leaving me to believe the command failed. When I load up Mysql through SSH and try to run SELECT * FROM databasename; I'm greeted with.... Empty set (0.00 sec)

My questions are...

  1. Does the "Empty set" return mean that the database is not importing correctly?
  2. Should MySQL return something if the database import was successful?
  3. ... Why is SQL not importing my database?

Thanks in advance.

8
  • Did you open the .sql and took a look at it? Can you determine if they're good sql statements or would you integrate your question with the sql file so we might help you solve this arcane. Commented Jun 2, 2017 at 14:36
  • Can you recommend a reader to open the file with? I'm on Mac. I did verify the file size is the same on my computer and on the server. Commented Jun 2, 2017 at 15:10
  • Use built in graphical text editor. TextEdit I guess.. Commented Jun 2, 2017 at 15:13
  • Ok - I used "sudo nano" and opened the file in the SSH window. It looks non-corrupted to me. Anything specifically I should be looking for? Commented Jun 2, 2017 at 15:26
  • Running a SELECT against a database isn't going to be productive. You need to run it against a table. Try use databasename then SELECT * from wp_users. Commented Jun 2, 2017 at 17:46

1 Answer 1

0

Just set slow_query_log = 1 (if >=5.6.1) or log_slow_queries = 1(if <5.6.1) and slow_query_log_file = /path/to/logfile and long_query_time = 0 in my.cnf, then restart mysql restore db again and have a look at the logfile. I won't keep it on on production envs, such a logging is a performance killer and may result in bad things if you are on heavy load. It may also get quickly very big as "long_query_time 0" results in logging everything, so "/path/to" should have plenty of free space.

This way you will log all server activity and you'll find what's going on with this restore query.

Disable such options as soon as you can.

5
  • Thanks for the reply! So I went through these steps... and after running the import again nothing appears in the log file. Also just to give more context - I believe the import is silently failing because as soon as I hit return on the import, it brings me to the next line with less than a second of wait time. Commented Jun 3, 2017 at 14:34
  • What if you mysql -uroot -p and then show databases? Commented Jun 3, 2017 at 14:39
  • It shows the database that I've imported. Commented Jun 3, 2017 at 14:53
  • So, you'd better move to Wordpress forum? :) Commented Jun 3, 2017 at 18:47
  • Yup - marked this as resolved. Thank you for the help @marco. Commented Jun 7, 2017 at 17:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.