centos二进制安装MySQL-5.7数据库

前端之家收集整理的这篇文章主要介绍了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';

猜你在找的CentOS相关文章