Linux快速安装Mysql5.7

 安装启动

# 下载
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

# 安装
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql mysql-server
yum -y install mysql-community-server

# 处理报错
cp /etc/yum.repos.d/mysql-community.repo /etc/yum.repos.d/mysql-community.repo_bak
sed -i 's/gpgcheck.*/gpgcheck=0/g' /etc/yum.repos.d/mysql-community.repo
yum -y install mysql-community-server

# 启动mysql
systemctl enable mysqld.service
systemctl start mysqld.service

# 查看密码
grep "password" /var/log/mysqld.log

最后的命令,获取默认密码

 修改root密码,并授权其他主机访问

# 进入数据库
mysql -uroot -p
-- 改密码为‘YourPassword@2022’并授权
ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourPassword@2022';
grant all privileges on *.* to 'root'@'%' identified by 'YourPassword@2022' with grant option;
flush privileges;


-- 其他命令
-- 创建数据库
create 数据库名称;
-- 查看数据库中记录数最多的10个表格
use information_schema;
select table_name,table_rows from tables where TABLE_SCHEMA = '数据库名称' order by table_rows desc limit 10;

-- 退出
exit

导入数据库

#导入数据库,‘YourPassword@2022’ 是数据库密码
mysql -uroot -pYourPassword@2022 -h127.0.0.1 -P3306 数据库名称</data/mysql/20220709.sql

参考文档:《mysql5.7安装》https://www.cnblogs.com/huaixiaonian/p/15949233.html

记录一句话,共勉~~~你能成就多少人,就有多少人成就你!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值