LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-08-2012, 10:37 PM   #1
kwickcut
Member
 
Registered: Nov 2004
Posts: 133

Rep: Reputation: 20
DBI connect failed : Access denied for user 'root'@'%' to database 'mysql'


this all started when i found out that my boot was 98% full and the system asked for a reboot. when i rebooted this is the error on the monitor
Code:
ernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
i used
Code:
dpkg --list | grep linux-image
to list the kernels and then used
Code:
apt-get remove linux-image-2.6.15-27-386 linux-headers-2.6.15-27-386
to remove the old kernels and header info and recovered 50% of my boot

now when i try to log into phpmyadmin as root i only see the
Code:
information_schema
data base and nothing else. now if i log into each site account i can see there database.

then when i log into webmin and select servers/MySQL Databases i only see 2 data bases and there should be 20 i checked under /var/lib/mysql and all of the databases are listed and all of the sites are up and running and also when i click on User Permissions,Database Permissions,Host Permissions,Table Permissions,Field Permissions,Database Connections,or MySQL System Variables i receive the following error
Code:
DBI connect failed : Access denied for user 'root'@'%' to database 'mysql'
from what i have read i need to reset my root password for mysql and i have done so using this
Code:
Stop the MySQL Server.

sudo /etc/init.d/mysql stop


Start the mysqld configuration.

sudo mysqld --skip-grant-tables &


Login to MySQL as root.

mysql -u root mysql


Replace YOURNEWPASSWORD with your new password!

UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
but i am still getting the same error and i can not log into phpmyadmin as root and see all of the databases

would love some input thanks


kwick
 
Old 02-09-2012, 02:49 PM   #2
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
do you have a backup of the database's

If you have a backup of them put them on a test server and see if you can access the data on the test box.
 
Old 02-09-2012, 03:12 PM   #3
kwickcut
Member
 
Registered: Nov 2004
Posts: 133

Original Poster
Rep: Reputation: 20
accessing the database is not the issue.if i log into phpmyadmin using each users account i can backup the databases or do whatever is needed. the issue is bring able to log into phpmyadmin as root and have access to all of the databases without logging in as a each user.

also under webmin/servers/mysql there are only 2 databases showing and there should be 20 showing

Last edited by kwickcut; 02-09-2012 at 03:15 PM.
 
Old 02-09-2012, 04:13 PM   #4
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
You can create a user and grant all on the user at the localhost and it should allow access via phpmyadmin.

I would recommend using another account other than root for security reasons.
 
Old 02-09-2012, 04:16 PM   #5
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
grant all privileges on *.* to 'dbuser'@'localhost' identified by 'password' with grant option;

flush privileges;
 
Old 02-09-2012, 04:46 PM   #6
kwickcut
Member
 
Registered: Nov 2004
Posts: 133

Original Poster
Rep: Reputation: 20
ok sound easy enough if i knew how lol.everything that i have posted i was able to find thief google.. would you happen to have the command? so maybe i could save a day looking for then thanks


kwick
 
Old 02-10-2012, 07:50 AM   #7
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
Quote:
Originally Posted by kwickcut View Post
ok sound easy enough if i knew how lol.everything that i have posted i was able to find thief google.. would you happen to have the command? so maybe i could save a day looking for then thanks


kwick
You can use one user name to administrate all of the databases globally.

mysql> grant all privileges on *.* to 'your_user_name'@'localhost' identified by 'strong_password' with grant option;

mysql> grant all privileges on *.* to 'your_user_name'@'hostname' identified by 'strong_password' with grant option;

flush privileges;

basically the above line is granting ALL rights to everything in mysql, also it is a good idea to run from the command line:

sudo /usr/bin/mysql_secure_installation

(this will ask you a series of questions removing the test database, anonymous users, and then it will flush privileges) and end

you do not want root to be allowed remotely to your server databases not your server

(you can allow the user name you create above to remotely administrate the databases as well by IP address and/or hostname you are sourcing from) not needed since you have phpmyadmin

I setup phpmyadmin for a user similar to the setup above in here, and it works great for him.

I *would* strongly recommend creating a iptable chain rule to limit the access to phpmyadmin since it redirects to 443. With it open to the Public Internet people will be working on it while you are not. You can open up a separate topic on it if assistance is needed. (I believe this is the correct method to adhere to forum policies)



Report back on your status.

Last edited by rhbegin; 02-10-2012 at 08:01 AM. Reason: edited commands
 
Old 02-10-2012, 12:11 PM   #8
kwickcut
Member
 
Registered: Nov 2004
Posts: 133

Original Poster
Rep: Reputation: 20
maybe i am missing something


Code:
root@server1:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1698
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> grant all privileges on *.* to 'mysuername'@'localhost' identified by 'mypassword for user' with grant option;
ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)
mysql>
 
Old 02-10-2012, 01:56 PM   #9
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
Was everything working before the file system filled up?

Do you have a backup of the databases before this happened?
 
Old 02-10-2012, 02:12 PM   #10
kwickcut
Member
 
Registered: Nov 2004
Posts: 133

Original Poster
Rep: Reputation: 20
yes everything was working and no i dont have a backup of the sql server but i do have a backup of each data base..

i think i may just let this go and build a new server and transfer all of the sites to the new box. then redo this one as a backup server

i cant afford to loose anything or have downtime on this box so i guess if its running leave well enough alone


thanks for the help

kwick
 
Old 02-10-2012, 02:18 PM   #11
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
That is what I do in these strange cases, if something happens I create another VM and migrate data to it.

Possible something got corrupt?

Glad to be of help, I know it is not very easy working with production systems when they experience problems. It never happens in a test environment, only in production.
 
Old 02-10-2012, 02:26 PM   #12
kwickcut
Member
 
Registered: Nov 2004
Posts: 133

Original Poster
Rep: Reputation: 20
lol you are so rite about that lol the real world breaks everything in time just not my spirit. i think it may be time to take a course at the local collage being that everything i know is from trail and error google and linuxquestions.org maybe if i am schooled i can help give back some

thanks once again



kwick
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MYSQL: Access denied for user 'root'@'localhost' (using password: NO) jun_tuko Linux - Software 3 03-05-2013 06:37 AM
MySQL Error Nr. 1045 Access denied for user 'root'@'192.168.0.28' (using password: YE uppalagayatri Linux - Software 9 05-11-2011 01:45 PM
Mysql error 1045: Access denied for user 'root'@'localhost' (using password: YES) visitashu Linux - Server 15 11-10-2010 11:05 PM
DBI Connect Failed:Access denied for user ''@'localhost' to database <database> error kaplan71 Linux - Software 3 06-05-2009 12:39 PM
Sarge mysql-server Access denied for user: root@localhost infinity432 Linux - Software 2 05-18-2005 11:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration