rm -rf /etc/my.cnf #删除系统默认的配置文件(如果默认没有就不用删除)
cd /usr/local/mysql #进入MySQL安装目录
./bin/mysqld --user=mysql --initialize --basedir=/usr/local/mysql --datadir=/data/mysql #生成mysql系统数据库
--initialize表示默认生成密码, --initialize-insecure 表示不生成密码, 密码为空。
看到这一行[Note] A temporary password is generated for root@localhost: CSJlm3DyTG.d
cp /usr/local/mysql/support-files/my-default.cnf /usr/local/mysql/my.cnf
ln -s /usr/local/mysql/my.cnf /etc/my.cnf #添加到/etc目录的软连接
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld #把MySQL加入系统启动
chmod 755 /etc/init.d/mysqld #增加执行权限
chkconfig mysqld on #加入开机启动
vi /etc/rc.d/init.d/mysqld #编辑
basedir=/usr/local/mysql #MySQL程序安装路径
datadir=/data/mysql #MySQl数据库存放目录
:wq! #保存退出
service mysqld start #启动
vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行
export PATH=$PATH:/usr/local/mysql/bin
:wq! #保存退出
source /etc/profile #使配置立刻生效
下面这两行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
mkdir /var/lib/mysql #创建目录
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock #添加软链接
mysql_secure_installation #修改Mysql密码,输入之前生成的密CSJlm3DyTG.d回车,根据提示操作。
Press y|Y for Yes, any other key for No: y #是否安装密码安全插件?选择y
There are three levels of password validation policy: #有以下几种密码强度选择
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 #选择0,只要8位数字即可,选1要有大写,小写,特殊字符等
相关操作:进入MySQL控制台
UNINSTALL PLUGIN validate_password ; #卸载密码强度插件
mysqladmin -uroot -p password 123456 #修改密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456'); #登录mysql控制台修改
alter user user() identified by '123456'; #修改密码
二、安装Nginx
1、安装pcre
cd /usr/local/src mkdir /usr/local/pcre tar zxvf pcre-8.39.tar.gz cd pcre-8.39 ./configure --prefix=/usr/local/pcre make make install
2、安装openssl
cd /usr/local/src mkdir /usr/local/openssl tar zxvf openssl-1.0.2j.tar.gz cd openssl-1.0.2j ./config --prefix=/usr/local/openssl make make install vi /etc/profile export PATH=$PATH:/usr/local/openssl/bin :wq! source /etc/profile








