第一次建立wordpress站点的时候搞得不明不白,这次建站,决定测试一下进入mysql的具体流程
经典步骤:
$ mysql -u adminusername -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON databasename.* TO "wordpressusername"@"hostname"
-> IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> EXIT
Bye
$
第一次测试,所有都用root用户名和密码,成功!
第二次,一般用户下,一般用户名登录mysql,无法创建数据库。
第三次,一般用户下,root登录,创建数据库,grant时用 ”yangsong3”@”localhost”,wordpress设置下用yangsong3,失败!
用root,成功~说明wordpress实际是用的root用户名访问mysql的。