建立博客系统的数据库
1 使用phpMyAdmin创建MySQL数据库
如果使用合适的工具,MySQL数据库的管理就会为得相当简单。应用MySQL命令行方式需要对MySQL知识非常熟悉,对SQL语言也是同样的道理。不仅如此,如果数据库的访问量很大,列表中数据的读取就会相当困难。当前出现很多GUI MySQL客户程序,其中最为出色的是基于Web的phpMyAdmin工具。这是一种MySQL数据库前台的基于PHP的工具。使用phpMyAdmin建立一个Mysql数据库WordPress ,以及相应权限和密码。界面见图3。

图3使用phpMyAdmin创建MySQL数据库
2 使用命令行工具
通常笔者更加喜欢命令行的方式,进入mysql的bin目录执行如下命令:
# mysql -u root -p
Enter password: xxxxxxxxx
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.18-nt
Mysql> create database wordpress ; "为b2evolution 建立数据库"
Query OK, 1 row affected (0.01 sec)
Mysql>grant all privileges on wordpres.* to wordpres@localhost identified by '123456' ; "将建立的wordprss 权限给wordpres 帐号,并且设定密码"
mysql>quit
Bye

图4 使用命令行方式建立数据库
测试一下刚刚建立的数据库
G:\wamp\mysql\bin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9 to server version: 5.0.21-community-nt
![]()
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
![]()
mysql> connect vtigercrm4_2 ;
Connection id: 10
Current database: vtigercrm4_2
![]()
mysql> show databases;
+--------------+
| Database |
+--------------+
| mysql |
| vtigercrm4_2 |
+--------------+
2 rows in set (0.00 sec)
mysql>quit
Bye
打开vTigerCRM根目录下的connection.php,修改里面的变量,使之和上面创建的数据库用户和密码以及mysql通信端口一致。
$mysql_username = 'C3CRM';
$mysql_password = 'C3CRM';
$mysql_port = '3306';