Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 28th October 2012, 23:31
SwOsHiE SwOsHiE is offline
HowtoForge Supporter
 
Join Date: Jun 2011
Location: Stockholm, Sweden
Posts: 82
Thanks: 8
Thanked 8 Times in 7 Posts
Send a message via Skype™ to SwOsHiE
Exclamation MySQL - root access denied if not 127.0.0.1

Hello,

Got a serious problem with our MySQL service a couple of days ago. You cannot login as root unless you type in "-h 127.0.0.1". I've searched and searched on the web and looked up so many things but still not getting it to work.

The things I've tried:
  • Checked that /etc/hosts points localhost to 127.0.0.1
  • Mysqld is running on port 3306 and with IPv4
  • The path to the mysql socket is correct both in my.cnf and debian.cnf
  • Checked that "bind adress" is uncommented

Getting really frustrated as ISPConfig is not able to make database changes!

I appreciate all the help I can get!!

Best regards,
Mattias
Reply With Quote
Sponsored Links
  #2  
Old 30th October 2012, 00:05
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Is this a physical server or a virtual machine? Did you try a reboot?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 30th October 2012, 12:20
SwOsHiE SwOsHiE is offline
HowtoForge Supporter
 
Join Date: Jun 2011
Location: Stockholm, Sweden
Posts: 82
Thanks: 8
Thanked 8 Times in 7 Posts
Send a message via Skype™ to SwOsHiE
Default

Hi falko!

This is a physical machine and just tried to reboot the mirrored server but still same problem..

If I'm correct "root@127.0.0.1" and "root@localhost" have different privileges but this can be solved by NOT using an options that I can't remember right now, but that option was turned off as default so localhost is automatically shown as 127.0.0.1 (or is it the other way around?).
Reply With Quote
  #4  
Old 1st November 2012, 09:08
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Which distribution do you use? Did you install any updates recently? Did you do any other changes right before this problem occurred?

What's in the Host column of the root users in the mysql.user table?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 1st November 2012, 22:16
SwOsHiE SwOsHiE is offline
HowtoForge Supporter
 
Join Date: Jun 2011
Location: Stockholm, Sweden
Posts: 82
Thanks: 8
Thanked 8 Times in 7 Posts
Send a message via Skype™ to SwOsHiE
Default

I use Debian 6.

I did some updates a while ago but no problems at that time, just recently I got a message from one of my clients that they couldn't create new databases, but use and show already made databases.

I think this is what your after, but if you want more columns just tell me!

+---------------------+-------------+
| host | user |
+---------------------+-------------+
| 127.0.0.1 | root
| localhost | debian-sys-maint
| xx.ffffff.net | root
| 192.168.XXX.XXX | root
+---------------------+-------------+

Shouldn't there be some line about root@localhost?

Best regards,
Mat
Reply With Quote
  #6  
Old 3rd November 2012, 01:28
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Quote:
Originally Posted by SwOsHiE View Post
Shouldn't there be some line about root@localhost?
Yes, that's right. Looks like that got lost somehow.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 3rd November 2012, 12:06
SwOsHiE SwOsHiE is offline
HowtoForge Supporter
 
Join Date: Jun 2011
Location: Stockholm, Sweden
Posts: 82
Thanks: 8
Thanked 8 Times in 7 Posts
Send a message via Skype™ to SwOsHiE
 
Default

Phew.. just solved the problem, thanks falko!

What I did:

Login to MySQL:
Code:
mysql -u root -p -h 127.0.0.1
Create the root@localhost account:
Code:
use mysql;
create user root@localhost;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
commit;
FLUSH PRIVILEGES;
exit;
Restart the MySQL service to fix changes:
Code:
service mysql restart
Stop the service and start in safe mode:
Code:
service mysql stop
mysqld_safe --skip-grant-tables&
Login as root:
Code:
mysql -u root
Change password for root:
Code:
use mysql;
UPDATE user SET Password=PASSWORD('YourNewPassword') WHERE User='root';
FLUSH PRIVILEGES;
exit;
Stop the safe mode and restart the service:
Code:
service mysql stop
service mysql start
That worked for me Thanks for all the help!
Reply With Quote
The Following User Says Thank You to SwOsHiE For This Useful Post:
falko (4th November 2012)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with Virtual Hosting With PureFTPd And MySQL (Incl. Quota And Bandwidth Mana ikkem HOWTO-Related Questions 33 8th June 2012 19:27
apache log issues abubin General 13 1st August 2010 18:47
/boot is 100% full Sohail Khawaja HOWTO-Related Questions 6 6th January 2010 21:32
Management/system config/settings & /server/settings not working!! dactor Installation/Configuration 9 6th February 2008 10:11
Add Webmin to the system sushestvo Installation/Configuration 44 21st August 2007 17:52


All times are GMT +2. The time now is 22:21.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.