1.上传到服务器中 2. 解压 解压是获取了Mysql各个安装包,并不只是直接安装成功了 cd /usr/local/mkdir mysqlcd /datatar -xvf mysql-8.0.2
解压是获取了Mysql各个安装包,并不只是直接安装成功了
cd /usr/local/mkdir mysqlcd /datatar -xvf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql查看是否解压成功cd /usr/local/mysql/ll
#以下三种都是查询是否安装过mysqlrpm -qa | grep mysqlrpm -qa | grep postfixrpm -qa | grep mariadb如果返回有安装,就删掉rpm -e mariadb-libs-5.5.68-1.el7.x86_64rpm -e postfix-2.10.1-9.el7.x86_64rpm -e mariadb-libs-5.5.68-1.el7.x86_64
安装依赖yum install perl -yyum install libaio -yyum install net-tools -y
本操作是为安装mysql准备文件夹
groupadd mysqluseradd -r -g mysql mysql创建文件夹(date)、授权mkdir -p /date/mysqlchown mysql:mysql -R /date/mysql
安装顺序(一定不要错)rpm包存放到哪个目录,就去哪个目录下去执行cd /usr/local/mysql/rpm -ivh mysql-commUnity-common-8.0.28-1.el7.x86_64.rpmrpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm --nodeps --forcerpm -ivh mysql-community-client-8.0.28-1.el7.x86_64.rpm --nodeps --forcerpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm --nodeps --force安装好之后,查看mysql服务的启动状态
启动服务systemctl start mysqld查看服务状态systemctl status mysqld# 开机自启systemctl enable mysqld
查看默认密码:grep passWord /var/log/mysqld.log用默认密码登录MySQLmysql -uroot -p输入默认密码登录
更改复杂的密码,把初始化密码换掉alter user 'root'@'localhost' identified by 'Root123.';重新登陆mysql -uroot -pRoot123.
查看密码规则show variables like 'validate%';更改密码,先修改密码规则set global validate_password.policy=0;set global validate_password.length=1;然后设置新密码ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';#重新登陆mysql -uroot -p123456
use mysql;select user,host from user;update user set host="%" where user="root";select user,host from user;flush privileges;
systemctl status firewalldsystemctl stop firewalldsystemctl disable firewalld
来源地址:https://blog.csdn.net/weixin_45955039/article/details/130144515
--结束END--
本文标题: linux安装mysql(8.0)
本文链接: https://lsjlt.com/news/420775.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0