LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-13-2008, 04:26 AM   #1
iiKster
LQ Newbie
 
Registered: Dec 2008
Location: Helsinki, Finland
Distribution: Slack
Posts: 3

Rep: Reputation: 1
Lost mysql root password on slack server


I am new to the forum so i apologize if I have posted this in the wrong place...

So the actual problem:
I have Slack 12 on a computer that acts as a web server. I tried to install MySQL a few days back and as I am fairly new to Linux I don't have a clue what I did. Somewhere the root password got lost an now when i try to get in to MySQL the following happens:

Quote:
root@geldar:~# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Is there a way to change the root password for MySQL if you don't know the current password? Alternatively, how do I get rid of the current MySQL installation in order to install a new one?
 
Old 12-13-2008, 04:34 AM   #2
twisted1919
LQ Newbie
 
Registered: Dec 2008
Posts: 17

Rep: Reputation: 1
how did you installed the mysql server ?
Compiled from sources , or with installpkg ?
If you did with installpkg then run pkgtool and remove the package from there ...
But , slackware comes with mysql server by default , why did you installed other version of mysql server ?
 
Old 12-13-2008, 05:09 AM   #3
iiKster
LQ Newbie
 
Registered: Dec 2008
Location: Helsinki, Finland
Distribution: Slack
Posts: 3

Original Poster
Rep: Reputation: 1
Let me refrace, i run
Quote:
mysql_install_db
 
Old 12-13-2008, 05:49 AM   #4
twisted1919
LQ Newbie
 
Registered: Dec 2008
Posts: 17

Rep: Reputation: 1
well that means you used the mysql server that comes with slackware by default .
To remove it , do it with removepkg tool , then , you can install a newer version of mysql .
You can download a new version from here http://slackware.osuosl.org/slackwar.../slackware/ap/
is allready compiled for slackware 12.2 so it works ok (even if you have slackware 12.1)

Hope this helps


Oh , let me show you something else :
Code:
root@linux-box11:/var# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
This happens because the syntax is not correct ...
The right way to do it is :
Code:
root@linux-box11:/var# mysql -u root -p
Enter password:  
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 699
Server version: 5.0.67 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Last edited by twisted1919; 12-13-2008 at 05:54 AM. Reason: added extra info
 
Old 12-13-2008, 05:54 AM   #5
iiKster
LQ Newbie
 
Registered: Dec 2008
Location: Helsinki, Finland
Distribution: Slack
Posts: 3

Original Poster
Rep: Reputation: 1
I think i got it working...

Code:

root@geldar:/etc/rc.d# mysqld_safe --skip-grant-tables &
[1] 28787
root@geldar:/etc/rc.d# nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql

root@geldar:/etc/rc.d# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.37 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=PASSWORD("NewPasswd") where User='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

root@geldar:/etc/rc.d# /etc/rc.d/rc.mysqld stop

root@geldar:/etc/rc.d# /etc/rc.d/rc.mysqld start
root@geldar:/etc/rc.d# nohup: redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql


root@geldar:~# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.37 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
 
1 members found this post helpful.
Old 12-13-2008, 06:06 AM   #6
twisted1919
LQ Newbie
 
Registered: Dec 2008
Posts: 17

Rep: Reputation: 1
Great news then
 
Old 12-29-2008, 06:30 PM   #7
Penthux
Member
 
Registered: Dec 2008
Location: Middlesbrough, UK
Distribution: Slackware
Posts: 264

Rep: Reputation: 74
better late than never...

There's a nice little how-to if you ever forget your MySQL root password:

Halt MySQL:
# /etc/rc.d/rc.mysql stop

Start MySQL in safe mode:
# mysqld_safe –skip-grant-tables &

Login to MySQL as root user:
# mysql -u root

Change the root user password:
mysql> use mysql;
mysql> update user set password=PASSWORD(”NEWPASSWD”) where user=’root’;
mysql> flush privileges;

** Your new MySQL root user password is now: NEWPASSWD
** Change this to your own preference.

Quit MySQL:
mysql> \q

Restart MySQL:
# /etc/rc.d/rc.mysql restart

# mysql --password=NEWPASSWD

## eof


I know this thread is a couple of weeks old now but this may help in future. :>
 
  


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
Lost of mysql root password satimis Linux - Server 6 12-06-2007 10:05 PM
mysql root password lost nazir Linux - Software 6 10-09-2007 11:18 AM
I have forgetten my MySQL server root password. ERBRMN Linux - General 3 03-08-2007 09:59 PM
lost mysql password, can't recover slackhack Linux - Software 1 12-03-2005 06:15 PM
MySQL default root password on Slack 9? Tarential Linux - Software 6 05-29-2003 07:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration