不少時間應用與數據庫是分開架設的,這樣能夠提供良好的訪問速度的。php
詳細配置以下:mysql
mysql> USE mysql; mysql> SELECT User, Password, Host FROM user; +------+----------+-----------+ | User | Password | Host | +------+----------+-----------+ | root | | localhost | +------+----------+-----------+ mysql> -- 只有一個默認的 root 用戶, 密碼爲空, 只容許 localhost 鏈接 mysql> -- 下面咱們另外添加一個新的 root 用戶, 密碼爲空, 只容許 192.168.1.100 鏈接 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.100' IDENTIFIED BY '' WITH GRANT OPTION; mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
mysql> SELECT User, Password, Host FROM user;
+------+-------------------------------------------+---------------+
| User | Password | Host |
+------+-------------------------------------------+---------------+
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost |
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | web-php |
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | 127.0.0.1 |
| root | | 192.168.4.101 |
+------+-------------------------------------------+----------------+web
修改root密碼sql
mysql> use mysql
Database changed
mysql> update user
set
password=PASSWORD(
'123456'
)
where
user=
'root'
;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT User, Password, Host FROM user;
+------+-------------------------------------------+---------------+
| User | Password | Host |
+------+-------------------------------------------+---------------+
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost |
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | web-php |
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | 127.0.0.1 |
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | 192.168.4.101 |
+------+-------------------------------------------+---------------+數據庫