LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2010, 03:46 AM   #1
Nintendo
LQ Newbie
 
Registered: May 2010
Posts: 9

Rep: Reputation: 0
How do I set a mySQL password?


er, that is, if it's even installed.

[root@vgchatcom ~]# mysqladmin -u root password XXXXX
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

So I see if I even have mySQL...

[root@vgchatcom ~]# mysql -V
mysql Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i386) using readline 5.1
[root@vgchatcom ~]# php -v
PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:10)

it looks like I do have mySQL installed. Or does...

[root@vgchatcom ~]# rpm -q mysql
mysql-5.0.77-3.el5

mean I still have to install it?? If so, how do I do that?
 
Old 05-19-2010, 03:49 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Try adding the -h localhost option.

mysqladmin -h localhost -u root password XXXXX

Hope this helps.
 
Old 05-19-2010, 04:45 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
First see if the mysql service is running. And if you have not set the root password for mysql, then you do not need it. By default, there is no password set.
 
Old 05-19-2010, 04:59 AM   #4
geovg
Member
 
Registered: Mar 2010
Posts: 40

Rep: Reputation: 1
use,

ps aux | grep mysql

to see if mysql is running. If mysql is running, use "mysql -u root -p" and enter password when the prompt for password for appears.
 
Old 05-19-2010, 05:04 AM   #5
Nintendo
LQ Newbie
 
Registered: May 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Is it running...

root 3301 0.0 0.0 4536 1256 ? S 03:36 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --user=mysql
mysql 3348 0.0 0.5 140952 24412 ? Sl 03:36 0:01 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
root 5274 0.0 0.0 3924 692 pts/0 S+ 04:04 0:00 grep mysql
[root@vgchatcom ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


And I tried...

[root@vgchatcom ~]# /sbin/service mysqld start
Starting MySQL: [ OK ]
[root@vgchatcom ~]# mysqladmin -h localhost -u root password PASSWORD-I-WANT-TO-CREATE
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Last edited by Nintendo; 05-19-2010 at 05:06 AM.
 
Old 05-19-2010, 05:10 AM   #6
geovg
Member
 
Registered: Mar 2010
Posts: 40

Rep: Reputation: 1
Quote:
Originally Posted by Nintendo View Post
Is it running...

root 3301 0.0 0.0 4536 1256 ? S 03:36 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --user=mysql
mysql 3348 0.0 0.5 140952 24412 ? Sl 03:36 0:01 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
root 5274 0.0 0.0 3924 692 pts/0 S+ 04:04 0:00 grep mysql
[root@vgchatcom ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


And I tried...

[root@vgchatcom ~]# /sbin/service mysqld start
Starting MySQL: [ OK ]
[root@vgchatcom ~]# mysqladmin -h localhost -u root password PASSWORD-I-WANT-TO-CREATE
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
yea, mysql is running. Follow this link to reset mysql root password
 
Old 05-19-2010, 11:45 AM   #7
Nintendo
LQ Newbie
 
Registered: May 2010
Posts: 9

Original Poster
Rep: Reputation: 0
[root@vgchatcom ~]# /sbin/service mysqld stop
Stopping MySQL: [ OK ]
[root@vgchatcom ~]# mysqld_safe --skip-grant-tables &
[1] 12525
[root@vgchatcom ~]# Starting mysqld daemon with databases from /var/lib/mysql

and it just sits and does nothing, and nothing, and nothing....

redhat-linux version 5.
 
Old 05-20-2010, 06:45 AM   #8
cola
Senior Member
 
Registered: Sep 2007
Location: Dhaka,Bangladesh
Distribution: Debian
Posts: 1,031

Rep: Reputation: 63
Quote:
Originally Posted by Nintendo View Post
[root@vgchatcom ~]# /sbin/service mysqld stop
Stopping MySQL: [ OK ]
[root@vgchatcom ~]# mysqld_safe --skip-grant-tables &
[1] 12525
[root@vgchatcom ~]# Starting mysqld daemon with databases from /var/lib/mysql

and it just sits and does nothing, and nothing, and nothing....

redhat-linux version 5.
Post:
Code:
ps aux | grep mysql
If mysqld is not running then
Code:
su
password:
service mysqld start
http://dev.mysql.com/doc/refman/4.1/...rmissions.html
 
  


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
Unable to set root password on new mysql install Arty Ziff Linux - Server 2 01-23-2009 12:17 AM
Set mysql root password in script jakev383 Debian 1 08-14-2008 05:11 PM
change Root Password even if the password in the grub is also set sheelnidhi Linux - General 6 08-30-2006 08:27 AM
Cannot Log into MySQL root password I just set... k41184 Linux - Software 3 07-18-2005 11:57 AM


All times are GMT -5. The time now is 11:09 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