ä¸ãè¿æ¥è¿ç¨æ°æ®åºï¼
1ãæ¾ç¤ºå¯ç
å¦ï¼MySQL
è¿æ¥è¿ç¨æ°æ®åºï¼192.168.5.116ï¼ï¼ç«¯å£â3306âï¼ç¨æ·å为ârootâï¼å¯ç â123456â
C:/>mysql -h
192.168.5.116 -P 3306 -u root -p123456
2ãéèå¯ç
å¦ï¼MySQL è¿æ¥æ¬å°æ°æ®åºï¼ç¨æ·å为ârootâï¼
C:/>mysql -h
localhost -u root -p
Enter password:
äºãé
ç½®mysqlå
许è¿ç¨é¾æ¥
é»è®¤æ
åµä¸ï¼mysqlå¸å·ä¸å
许ä»è¿ç¨ç»éï¼åªè½å¨localhostç»å½ãæ¬ææä¾äºäºç§æ¹æ³è®¾ç½®mysqlå¯ä»¥éè¿è¿ç¨ä¸»æºè¿è¡è¿æ¥ã
ä¸ãæ¹è¡¨æ³
å¨localhostç»å
¥mysqlåï¼æ´æ¹ "mysql" æ°æ®åºéç "user" 表éç "host"
项ï¼å°"localhost"æ¹ç§°"%"
ä¾å¦ï¼
ãã#mysql -u root
-p
Enter password:
â¦â¦
mysql>
ããmysql>update user
set host = '%' where user = 'root';
ããmysql>select host,
user from user;
äºãæææ³
ä¾å¦ï¼
ä½ æ³myuser使ç¨mypasswordï¼å¯ç ï¼ä»ä»»ä½ä¸»æºè¿æ¥å°mysqlæå¡å¨çè¯ã
ããmysql>GRANT ALL
PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
ããå¦æä½ æ³å
许ç¨æ·myuserä»ip为192.168.1.6ç主æºè¿æ¥å°mysqlæå¡å¨ï¼å¹¶ä½¿ç¨mypasswordä½ä¸ºå¯ç
ããmysql>GRANT ALL
PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY
ãã'mypassword' WITH GRANT OPTION;
mysql>FLUSH
PRIVILEGES
ãã使修æ¹çæï¼å°±å¯ä»¥äº
常è§é®é¢ï¼
1ãå¨éç¨æ³äºæææ³ä¹åï¼æ æ³å¨æ¬å°ç»å½mysqlï¼å¦ï¼#mysql -u root -p -h
192.168.5.116
Enter password:
ERROR 1045 (28000): Access denied for user
'root'@'loadb116' (using password: YES)
ä¸ä¾ä¸loadb116æ¯ä¸»æºå.
解å³æ¹æ³ï¼
1ãè¿æ¶å¯ä»¥ä½¿ç¨ï¼mysql -u
root -p ç»å½ï¼è¿å
¥å°mysqlåã
mysql> grant all privileges on *.* to 'root'@'loadb116'
identified by '123456' with grant option;
Query OK, 0 rows affected
(0.00 sec)
mysql> flush
privileges;
Query OK, 0 rows affected (0.00
sec)
2ãå¨æ¬å°ä½¿ç¨ipå°åç»å½
#
mysql -u root -p -h
192.168.5.116
Enter password:
Welcome to the MySQL
monitor. Commands end with ; or /g.
Your MySQL connection id is 60
Server
version: 5.1.45 MySQL Community Server (GPL)
Type 'help;' or '/h' for
help. Type '/c' to clear the buffer.
mysql>
温馨提示:答案为网友推荐,仅供参考