I'd Lost My MySQL Priviliges

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.

I'd Lost My MySQL Priviliges

Postby zAm » Sun Dec 11, 2005 9:53 am

Hello,
Guys .... i need help regarding mysql priviliges. somehow , i deleted all the priviliges of user root of mysql , now i am not able to create/edit any database .. can somebody tell me how would i get back my access . unfortunately , this happened with phpMyAdmin , i remove the all priviliges with phpMyAdmin .... please somebody help me .. i would be thankful to him . Thanks
Regards,
zAm (Lyarianz Internet Cable Network)
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi

Re:

Postby LinuxFreaK » Sun Dec 11, 2005 2:49 pm

Dear zAm,
Salam,

Use following commands

# service mysql stop
# mysqld_safe --skip-grant-tables --old-passwords --user=root &
# mysql


Code: Select all

mysql> UPDATE mysql.user SET Password=PASSWORD('qwerty') WHERE User='root';


Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

Postby zAm » Sun Dec 11, 2005 3:28 pm

Hello,
LinuxFreak ...... well i execute the following command after stopping the mysqld service ..it shows me this error :
[root@lyarianz ~]# mysqld_safe --skip-grant-tables --old-passwords --user=root &
[4] 1500
[3] Exit 127 mysqld_safe --skip-grant-tables --old-passwords --user=root
[root@lyarianz ~]# -bash: mysqld_safe: command not found

what's that ??
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi

Re:

Postby LinuxFreaK » Sun Dec 11, 2005 3:31 pm

Dear zAm,
Salam,

its means your does not have mysqld_safe command or might be not available in your path.

# rpm -ql mysql-server | grep safe

or

# rpm -ql MySQL-server | grep safe

Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

rpm -ql mysql-server | grep safe , that command exists

Postby zAm » Mon Dec 12, 2005 12:25 pm

Hello,
LinuxFreak ... when i execute that cmd 'rpm -ql mysql-server | grep safe' so i got this , it means that mysql-server & it's command mysqld_safe exists .... here it is .
[root@lyarianz ~]# rpm -ql mysql-server | grep safe
/usr/bin/safe_mysqld
so what could be else the problem ? i really wanted to make another databases but wish i could ........ huh ... ? anyway's ... thanks for your replies ......... what about that one now ?? Thanks ,
Regards,
zAm (Lyarianz Internet Cable Network)
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi

Re:

Postby LinuxFreaK » Tue Dec 13, 2005 8:56 am

Dear zAm,
Salam,

# service mysql stop
# /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=root &
# mysql


Code: Select all

mysql> UPDATE mysql.user SET Password=PASSWORD('qwerty') WHERE User='root';


Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

mysql errors

Postby zAm » Wed Dec 14, 2005 2:50 am

Hello,
LinuxFreak , i execute your given commands , i got that error ... i am newbie in mysql database & linux too , hope you won't bother to help me out ..... here's what i got ...

[root@lyarianz ~]# /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=root &
[1] 10981
[root@lyarianz ~]# Starting mysqld daemon with databases from /var/lib/mysql
051214 01:30:33 mysqld ended


[1]+ Done /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=root

[root@lyarianz ~]# mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
[root@lyarianz ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.58

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

mysql> UPDATE mysql.user SET Password=PASSWORD('qwerty') WHERE User='root';
ERROR 1142: update command denied to user: 'root@localhost' for table 'user'
mysql>
what should i do now ??
Regards,
Lyarianz Internet Cable Network
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi

Re:

Postby LinuxFreaK » Wed Dec 14, 2005 8:26 am

Dear zAm,
Salam,

I do not know what you are trying to do first you did not stoped mysql process and when you issue mysql -p it ask you root password and if you don't know your root password then you can not login into mysql...

But if you still wanna reset your MySQL root password. follow these steps...

# service mysql stop
# /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=mysql &
# mysql


Code: Select all

mysql> use mysql
mysql> update user set password=PASSWORD('qwerty') where user='root';


Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

i've lost mysql priviliges , not password

Postby zAm » Wed Dec 14, 2005 1:46 pm

Hello,
LinuxFreak ....... i am sorry that you don't understood my question properly ........... i remember the password , infact i can login to mysql with user root , but the problem is that i've lost my all priviliges of user root, like create,delete,edit databases. & i just wanted my priviliges back ...... i unfortunately remove my priviliges from phpMyAdmin , & now when i access phpMyAdmin so i got a error like No Privileges .....check this out
http://www.lyarianz.ukonline.co.uk/mysql.JPG
how can i get back my priviliges ....... anyway out .. i also tried to un-install mysql but it's show me a lot of errors of dependencies .... so i just couldn't ....... any way to get back my priviliges ... i had just this user root of mysql, not any user with all priviliges ...... there must be a way out , right ? Thanks for your kind replies ..... glad to see your replies always ....
Regards,
zAm (Lyarianz Internet Cable Network)
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi

Postby lambda » Thu Dec 15, 2005 5:17 pm

login as root, and type

Code: Select all

grant all on *.* to root@localhost identified by 'some-password' with grant option;
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

this command isn't working

Postby zAm » Thu Dec 15, 2005 7:58 pm

Hello,
lambda , thanks for your reply but this isn't working with me , check this out

Code: Select all

[root@lyarianz ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 3.23.58

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

mysql> grant all on *.* to root@localhost identified by 'some-password' with grant option;
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)

any idea ? how to gain back my priviliges of mysql again ? Thanks
Regards,
zAm (Lyarianz Internet Cable Network)
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi

Re:

Postby LinuxFreaK » Fri Dec 16, 2005 8:38 am

Dear zAm,
Salam,

Do same procedure using skip-grant-tables and it will solve your problem.

# service mysql stop
# /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=mysql &
# mysql


Code: Select all

mysql> grant all on *.* to root@localhost identified by 'some-password' with grant option;


# service mysql restart

Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

the same problem again

Postby zAm » Fri Dec 16, 2005 11:18 pm

Hello,
LinuxFreak ..... still experiencing the same problem again & again ... here's what i've got in my bash prompt....

Code: Select all

[root@lyarianz ~]# service mysqld stop
Stopping MySQL:                                            [  OK  ]
[root@lyarianz ~]# /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=mysql &
[1] 12110
[root@lyarianz ~]# Starting mysqld daemon with databases from /var/lib/mysql
051216 22:01:12  mysqld ended


[1]+  Done                    /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=mysql
[root@lyarianz ~]# service mysqld start
Starting MySQL:                                            [  OK  ]
[root@lyarianz ~]# mysql -u --root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all on *.* to root@localhost identified by 'some-password' with grant option;
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)

Thanks
Regards,
zAm (Lyarianz Internet Cable Network)
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi

Re:

Postby LinuxFreaK » Sat Dec 17, 2005 8:41 am

Dear zAm,
Salam,

Code: Select all

mysql> grant all on *.* to 'root'@'localhost' identified by 'some-password' with grant option;


Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

the same problem

Postby zAm » Sat Dec 17, 2005 11:06 pm

Hello,
LinuxFreak ... the same problem exists again with the cmd which u told me .................. any idea ??

Code: Select all

[root@lyarianz ~]# service mysqld stop
Stopping MySQL:                                            [  OK  ]
[root@lyarianz ~]# /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=mysql &
[1] 12110
[root@lyarianz ~]# Starting mysqld daemon with databases from /var/lib/mysql
051216 22:01:12  mysqld ended


[1]+  Done                    /usr/bin/safe_mysqld --skip-grant-tables --old-passwords --user=mysql
[root@lyarianz ~]# service mysqld start
Starting MySQL:                                            [  OK  ]
[root@lyarianz ~]# mysql -u --root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all on *.* to 'root'@'localhost' identified by 'some-password' with grant option;
ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
mysql>
Proud To Be Lyarianz !
zAm
Havaldaar
 
Posts: 148
Joined: Wed Oct 19, 2005 9:28 am
Website: http://www.zubair.moghal.ukonline.co.uk
WLM: z_moghal@hotmail.com
Yahoo Messenger: z_moghal@yahoo.com
Location: Pakistan, Karachi


Return to “%s” Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron