# Can't import wordpress db to mysql



## maudib (Jul 25, 2012)

Hi there
I installed FAMP+wordpress in a jail. I'm trying to import the wordpress database from a linux server. *Mysqldump* completed on this Linux server with no errors. Also I can connect to the FreeBSD wordpress admin page from other hosts on the network. The wordpress database has been created and the privileges have been set according to this. However when I do:
`# mysql -u root -p wordpress < /root/word_dump.sql`
I get this error:

```
Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
```
The word_dump.sql got moved with mv to /root in the jail before running the above command.
I'e googled but only found, mostly stuff on phpmyadmin and quite a lot of unanswered stuff. I tried --skip-grants-table in various combinations(with -u root -p, with just -u root, on it's own) to no avail. It said unknown option. I'm not wanting you to trawl through the masses of stuff on mysql errors. I just thought someone might already know or have experienced something similar!
Any help would be great, thank you for any replies.


----------



## SirDice (Jul 25, 2012)

By default the root MySQL account doesn't have a password. So unless you modified it use the command without *-p*.

Be sure to put a proper password on the account though.


----------



## shitson (Jul 25, 2012)

Are you able to just login to mysql fullstop?


```
mysql -u root -p
```
 or 
	
	



```
mysql -u root
```
?


----------



## maudib (Jul 25, 2012)

Yes *I* can login to mysql from inside the jail, with:

```
mysql -u root -p
```
and the password is set and works when doing this. That's how *I* managed to follow the instructions in the link *I* put earlier in this thread. I've also tried logging in from the linux server over the network, with all the firewall disabled and that gave me another error after the same root password, for FreeBSD's mysql, was entered on this linux server. Otherwise if it had let me login over the network *I* would have tried to send the wordpress database through the network.
Thanks for the replies.


----------



## SirDice (Jul 25, 2012)

Make sure your root user has been granted access to the wordpress database you created. Also review the commands, especially the first few ones of the *mysqldump*. It may try to set something that isn't allowed.


----------



## maudib (Jul 25, 2012)

So at the moment *I*'ve got 2 users for this database root and wordpress should *I* try setting a NULL password for both. I don't see how it would help as *I* can login as root at the moment anyway and it's still not letting me import wordpress!
I've just read your latest reply SirDice. I'll try granting privileges to root on the wordpress database. However *I* did previously grant acces to the wordpress database to the wordpress user and that didn't work (*I* think!).
Thank*s* a lot for your speedy reply.


----------



## maudib (Jul 25, 2012)

I've just done:

```
mysql> GRANT ALL ON wordpress.* to 'root'@'localhost' IDENTIFIED BY 'wordpress password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON wordpress.* to 'root'@'host_name' IDENTIFIED BY 'wordpress_password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON wordpress.* to 'root'@'192.168.2.58' IDENTIFIED BY 'wordpress_password';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
```
And it still doesn't let me do it. Also I did it setting it as the same but with 'root_password' instead of 'word_press_password' and that didn't work either. So it didn't work when the wordpress_user's password was the same as root or when they were different
regards


----------



## SirDice (Jul 25, 2012)

After changing GRANTs make sure to do a *FLUSH PRIVILEGES;*.


----------



## maudib (Jul 25, 2012)

*[solved]*

I temporarily set the bind_address in my.cnf to 0.0.0.0 and used --password=password on the commandline.It returned with no errors. Does this mean the data is in the database? Can I check if it is without PHP?
And thanks a lot for all the replies. I'll mark it as solved as soon as I know for sure.
regards


----------



## OH (Jul 25, 2012)

```
$ mysql -u root -p
mysql> SHOW DATABASES;
mysql> USE wordpress;
mysql> SHOW TABLES;
mysql> SELECT * FROM wp_users;
```
Note: database and table names may differ, but if it was a live website, it should at least have one user in the appropriate table.

If not yet succesful, wouldn't it be easier to use mysqlimport?


----------

