Authorization method:
run on the machine where mysql is installed:
1. # ./bin/mysql -uroot -p
//This should be able to enter the MySQL server
2. mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION
//Give any host permission to access data
For example, if you want myuser to use mypassword to connect to the mysql server from any host. (most commonly used)
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
if you want to allow user myuser to connect to the mysql server from the host whose ip is 192.168.1.6, and use mypassword As password
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
3. mysql>FLUSH PRIVILEGES
//The modification takes effect
4. mysql>EXIT
// Exit the MySQL server so that you can log in as root on any other host
Reference article: http://blog.chinaunix.net/uid-20577907-id-3082601.html