Friday, August 31, 2012

Mysql:Give Root User Logon Permission From Any Host
------------------------

 Note that this is Not very secure, and should only be used for a local development box .

To configure this feature, you’ll need to update the mysql user table to allow access from any remote host, using the % wildcard.

Open the command-line mysql client on the server using the root account. There is a chance getting Access denied error.
-------------------

[root@vps mysql]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
 -------------------

 Then you need to reset mysql password. For doing the same you need to stop the current mysql instance and then start mysql in safe mode.

--------------------

 #service mysqld stop or
#killall mysqld


 /usr/bin/mysqld_safe  --skip-grant-tables&


Now Connect to MySQL
#/usr/bin/mysql
Use the mysql database:
mysql>use mysql;
Change the MySQL admin(root) Password using following command


update user set password=password('wgstlfdse') where user='root' and host='localhost';

lush the privileges so everything will take (It removes any privileges set by the server)
mysql>flush privileges;
Then Quit : mysql>quit
Stop MySQL Service
/etc/init.d/mysqld stop
Start MySQL Service
/etc/init.d/mysqld start


Then connect mysql again 

 
 [root@vps ~]# mysql -u root -p
Enter password:


Use the mysql database:
mysql>use mysql;

Now I’ll update the server host to use the wildcard, and then issue the command to reload the privilege tables.

 update user set host='%' where user='root' and host='localhost';

FLUSH PRIVILEGES;


Also change  bind-address value in my.cnf like below.

--------------------
bind-address= *
---------------------


That’s all there is to it.


 

No comments:

Post a Comment