0

Have tried all other answers on stackoverflow, and they haven't worked. I have a database in phpMyAdmin, and I need to update it. The file is too big to upload via phpMyAdmin, and I've tried increasing limits in php.ini to no avail. I think that didn't work because I updated php.ini in public_html, and phpMyAdmin gets it memory/upload limits from the global file.

Anyhow, people recommend command line, so this is what I tried:

# mysql -u db_username -p db_pw -h localhost  existing_empty_db_name < new_db.sql 

Then it just gives me a huge list of mysql options, and does nothing else. I refresh the db in phpMyAdmin, and nothing has changed. What am I missing?

1 Answer 1

1

You are missing the -D option here. Correct syntax would be:

mysql -u db_username -p db_pw -h localhost -D existing_empty_db_name < new_db.sql 
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you. I'm now getting "Access denied for user 'db_username'@'localhost'. Should I be entering the password for the server, or for the db?
@JaydenLawson Well, then you need to provide proper permissions to this user, or use another user. You can modify permissions using phpmyadmin.
Thanks @shivams! No one in previous stackoverflow answers had explained that the username/password was for the account being used to log in to the server. I assumed that it was the username and password of the database! Because I logged in as root, this command worked perfectly: mysql -u root -p -h localhost -D existing_empty_db_name < new_db.sql Note that I had to drop all tables in that database before it would successfully import. Thanks so much!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.