Showing posts with label grant. Show all posts
Showing posts with label grant. Show all posts

Thursday, September 12, 2013

MySQL Grant Password Error : ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number



When you creating a new user for a MySQL server with the below method sometime you may get this below error.

Ex:

mysql>grant all privileges on *.* to 'root'@'localhost' identified by password 'welcome';

"ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number"


Solution:

mysql> select password ('welcome');

+-------------------------------------------+
| password ('welcome')           |
+-------------------------------------------+
| *DF216F57F1F2066124E1AA5491D995C3CB57E4C2 |
+-------------------------------------------+

1 row in set (0.02 sec)

mysql>grant all privileges on *.* to 'root'@'localhost' identified by password '*DF216F57F1F2066124E1AA5491D995C3CB57E4C2';

 Query OK, 0 rows affected (0.02 sec)

mysql>flush privileges;

 Query OK, 0 rows affected (0.02 sec)


Now the error gone.Try this when you are getting this error.


Better always try this below way to create MySQL user.

mysql>grant all privileges on *.* to 'root'@'localhost' identified by 'welcome';

Query OK, 0 rows affected (0.00 sec)

mysql>flush privileges;

Query OK, 0 rows affected (0.02 sec)



Sunday, February 3, 2013

STEPS TO DO FOR MASTER SLAVE REPLICATION IN MySQL

What is Replication?
          
      It is a process that allows you to easily maintain multiple copies of a MySQL data by copied automatically from a master to a slave database. 

Steps to do Replications:

1.Stop the running applications in master server

2.See master status.

Note the binlog file and position in notepad for slave server

3.Create a user for replication in master

4.Change the server id,port number and socket.

5.In slave give as,

            Ex: Change master to master_user='replica',
                                              master_host='localhost',
                                              master_password='replica',
                                              master_log_file='mysql-bin.000015',
                                              master_log_position=107,
                                              port=3306;

6. Start the replication by,
       
           Ex: start slave;

7.Import the master server databases to slave server now
     
   


Thank you.