紧接上一篇,Open×××使用用户名密码登录之后,觉得可能本地文件的安全性不是很好,毕竟密码还是明文显示的嘛,所以这次鼓捣Open×××使用MySQL进行认证。部署环境什么的,依然参考上一篇中的配置,不同的是,需要在Open×××上安装MySQL数据库。
1、安装MySQLyum -y install mysql-server mysql-devel mysql
/etc/init.d/mysqld start
chkconfig mysqld on
2、创建open***数据库以及相关表mysqladmin -u root password 123456
mysql -uroot -p123456
mysql> create database open***;
Query OK, 1 row affected (0.00 sec)
mysql> use open***;
Database changed
mysql> create table ***user (
-> name char(100) not null,
-> password char(255) default null,
-> active int(10) not null default 1,
-> primary key (name)
-> );
Query OK, 0 rows affected (0.06 sec)
mysql> desc ***user;
+----------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-----------+------+-----+---------+-------+
| name | char(100) | NO | PRI | NULL | |
| password | char(255) | YES | | NULL | |
| active | int(10) | NO | | 1 | |
+----------+-----------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> create table logtable (
-> msg char(254),
-> user char(100),
-> pid char(100),
-> host char(100),
-> rhost char(100),
-> time char(100)
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> desc logtable;
+-------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------+------+-----+---------+-------+
| msg | char(254) | YES | | N