Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Feb 21, 2014 3:56 pm 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
Hi Everyone,

I am adding two new websites to my linode . It was installed using the prebuilt wordpress stack script so I was never sure what the user name for the mysql was. I am trying to import the database using
Code:
mysql -u username -ppassword database_name < FILE.sql
but I am getting permission problems. I have tried the command to list mysql database users but I also get an error about permission for that. What should I do here?
bellajo.com is the site / database I am trying to link.

PS :: After doing this and getting to this part, my website that was previously up is now having a database issue!! I did not even touch anything regarding that website ! Can anyone shed some light on this I am at a loss of ideas.


Top
   
PostPosted: Sat Feb 22, 2014 10:07 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Can you log into mysql using the -u mysql_root_user -p option (no db name and no input file)?

If you can log in as root, check the permissions for the user and db that you're trying to use to import your sql file.


Top
   
PostPosted: Sat Feb 22, 2014 11:39 am 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
I ran a line in sql to figure out the users since I was not aware of them due to the fact I used a stack script.

The output came out with this
Code:
+------------------+
| user             |
+------------------+
| root             |
| root             |
|                  |
| root             |
|                  |
| debian-sys-maint |
| root             |
| wordpress        |
+------------------+


I got the line of code to transfer the sql file into mysql database to work but it does not seem to be connecting. Still having the error establishing a database connection.
When this line executed properly for bellajo.com is when the site (bwsurfshop.com) that was already running became effected.

I guess the first question is how to get my original sites database linked back up. Then move to figuring out the other sites. Any thoughts on how I would accomplish this?

-Tantrik


Top
   
PostPosted: Sat Feb 22, 2014 11:58 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Tantrik,
Am I correct in assuming that you're using the 'wordpress' user in your db configuration settings? What do you get when you run this command in mysql:
show grants for 'wordpress'@'%' ;


MSJ


Top
   
PostPosted: Sat Feb 22, 2014 1:11 pm 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
I would assume so yes, that was how the stack script was set up as far as I know.

I ran that line and came out with this,
Code:
ERROR 1141 (42000): There is no such grant defined for user 'wordpress' on host '%'

Which I would assume means there is no permissions set to any users? Appreciate your time and help MSJ !

EDIT :: I am not a fan of having multiple users since I am the only person using the server. Would if be possible to simple have one master user that can control all the databases?

-Tantrik


Top
   
PostPosted: Sat Feb 22, 2014 5:15 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Tantrik,
I was guessing that your database user for your site was 'wordpress'. It's never a good idea to have your website or web application use the root user for database access. It's is a very bad security practice.

What user is defined in your wp-config.php file? It looks something like this:
Code:
/** MySQL database username */
define('DB_USER', 'your db user name');


MSJ


Top
   
PostPosted: Sat Feb 22, 2014 5:31 pm 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
Just went through all that, checked all settings for database 'wordpress' in my wp-congif.php and it looks like this
Code:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpress');

/** MySQL database password */
define('DB_PASSWORD', ‘passwordhere’);

/** MySQL hostname */
define('DB_HOST', 'localhost');

Check all the settings on the SQL side and seems to be good. Any ideas from here?

-Tantrik


Top
   
PostPosted: Sat Feb 22, 2014 7:52 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
You are using the 'wordpress' mysql user but have not given it any privileges (based on your previous posts). That is why it can't access the database.

You need to give the 'wordpress' mysql user the correct permissions to access the 'wordpress' database or use a different mysql user to connect to the database.


Top
   
PostPosted: Sat Feb 22, 2014 8:25 pm 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
Main Street James wrote:
You are using the 'wordpress' mysql user but have not given it any privileges (based on your previous posts). That is why it can't access the database.

You need to give the 'wordpress' mysql user the correct permissions to access the 'wordpress' database or use a different mysql user to connect to the database.


How would one achieve this?


Top
   
PostPosted: Sat Feb 22, 2014 8:35 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Tantrik wrote:
How would one achieve this?
Running this command in mysql will do it:
Code:
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';

"wordpress.*" refers to the database and "'wordpress'@'localhost'" refers to the user.


Top
   
PostPosted: Sat Feb 22, 2014 8:39 pm 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
I have granted permission but still no luck. There were also 0 rows effected which makes me think that wasn't the problem? Thoughts? This is running me around in circles :P

-Tantrik


Top
   
PostPosted: Sat Feb 22, 2014 8:42 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
You'll also have to "FLUSH PRIVILEGES;"

It still may say '0' rows affected. You should try to see if Wordpress connects.


Top
   
PostPosted: Sat Feb 22, 2014 8:43 pm 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
Yes I have been using that command after doing changes in my SQL. Still no go. The site I'm trying to connect is bwsurfshop.com if that helps anything.


Top
   
PostPosted: Sat Feb 22, 2014 8:48 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Did you try importing the database? If you have't done the "mysql -u username -ppassword database_name < FILE.sql" yet then you can't connect because the DB doesn't exist.


Top
   
PostPosted: Sat Feb 22, 2014 9:00 pm 
Offline
Junior Member

Joined: Fri Oct 04, 2013 7:23 pm
Posts: 28
I will try that out and let you know how it goes, I am just not too sure why I would need to do that after I simply added a few virtual host files. I never even messed with the databases regarding this website. Will edit post when I have more of an idea. Thanks MSJ .

EDIT :: I never made a SQL backup for my main website although all the actual web files are unaltered from the working config. Did not expect this site to go down and have DB issues while working on a completely different site :| . Is there by default a sql file in the contents of the web folders I can use to link?

EDIT EDIT :: Just found out there is a way to dump the database info into a sql file which I can maybe use to connect the site back up? Is this possible? I am having trouble using the command
Code:
mysqldump -u [username] -p[password] [databasename] > [filename.sql]
- it seems to go through without any output but I have no idea where that sql file would be if it was even created. Thanks again !

-Tantrik


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group