centos7安装mysql
1.下载MySQL mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar2.在/usr创建文件夹mkdir mysql3.解压tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar -C mysql4.安装cd mysqlrm -f mysql-community-server-minimal-5.7.24...
·
1.下载MySQL mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar
链接:https://pan.baidu.com/s/1o1ZSVPKtA3xj2jEw0HlIQQ
提取码:2fwi
2.在/usr创建文件夹
mkdir mysql
3.解压
tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar -C mysql
4.安装
cd mysql
rm -f mysql-community-server-minimal-5.7.24-1.el7.x86_64.rpm
yum install mysql-community-{server,client,common,libs}-* mysql-5.*
5.启动
systemctl start mysqld
6.获取零时密码
grep 'temporary password' /var/log/mysqld.log
7.修改root用户密码,用上面提取到的密码登录:
mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
8.创建使用用户
mysql> grant all privileges on *.* to 'mike'@'%' identified by 'Mike666!';
mysql> flush privileges;
9.对数据库授权
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
10.FirewallD防火墙开放3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
11.连接
12.本人安装过程的错误集
1.Linux:useradd: group ‘mysql’ does not exist
解决措施:
groupadd mysql
useradd -r -g mysql mysql
查看用户组# groups mysql
查看是否存在mysql
rpm -qa |grep -i mysql
2.执行systemctl start mariadb.service后终端控制台报如下错误:
Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details.
解决方法如下:
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y
之后执行
systemctl start mariadb.service
mariadb服务启动成功
3.unknown variable ‘thread_concurrency=8’
vi /etc/my.cn
注释掉thread_concurrency=8
4.安装mysql后在/var/log/mysqld.log 中找不到临时密码
1.删除原来安装过的mysql残留的数据(这一步非常重要,问题就出在这)
rm -rf /var/lib/mysql
2.重启mysqld服务
systemctl restart mysqld
3.再去找临时密码
grep 'temporary password' /var/log/mysqld.log
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献1条内容
所有评论(0)