前端之家收集整理的这篇文章主要介绍了
centos二进制安装MySQL-5.7数据库,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
wget http://mirrors.sohu.com/
MysqL/
MysqL-5.7/
MysqL-5.7.17-linux-glibc2.5-x86_64.tar.gz mv
MysqL-5.7.17-linux-glibc2.5-x86_64.tar.gz /usr/local/ cd /usr/local/ tar -zxvf
MysqL-5.7.17-linux-glibc2.5-x86_64.tar.gz mv
MysqL-5.7.17-linux-glibc2.5-x86_64
MysqL cd
MysqL cd support-files/ cp my-default.cnf /etc/my.cnf vi /etc/my.cnf 输入 [
MysqL] default-character-set=utf8 [
MysqLd] default-storage-engine=INNODB character_set_server=utf8 拷贝
MysqL启动
文件 cp
MysqL.server /etc/init.d/
MysqL vi /etc/init.d/
MysqL 在对应位置
添加 basedir=/usr/local/
MysqL datadir=/usr/local/
MysqL/data 创建和
MysqL相关的
用户和
用户组 groupadd
MysqL useradd -r -g
MysqL MysqL passwd
MysqL chown -R
MysqL:
MysqL /usr/local/
MysqL/ usermod -d /home/
MysqL MysqL 初始化
数据库 ./
MysqLd --initialize --user=
MysqL --basedir=/usr/local/
MysqL --datadir=/usr/local/
MysqL/data 根据初始日志记录,得到root@localhost的初始密码oEo&PI>hL46n 启动
数据库 ./
MysqLd_safe --user=
MysqL &
登录后
修改root密码 ./
MysqL -uroot -p 然后设置密码为chenli set password=password('chenli'); grant all privileges on *.* to root@'%' identified by 'chenli'; grant all privileges on *.* to root@'192.168.1.98' identified by 'chenli'; flush privileges; 设置开机启动 chkconfig --add
MysqL chkconfig
MysqL on GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'chenli' WITH GRANT OPTION; GRANT ALL ON *.* TO 'root'@'%'; GRANT ALL ON *.* TO 'root'@'localhost'; GRANT ALL ON *.* TO 'root'@'127.0.0.1'; CREATE USER 'sa'@'%' IDENTIFIED BY 'chenli'; CREATE USER 'sa'@'localhost' IDENTIFIED BY 'chenli'; CREATE USER 'sa'@'127.0.0.1' IDENTIFIED BY 'chenli'; GRANT ALL ON *.* TO 'sa'@'%'; GRANT ALL ON *.* TO 'sa'@'localhost'; GRANT ALL ON *.* TO 'sa'@'127.0.0.1';