标签:baseurl sea too min serve mys tools nec my.cnf
以下实践操作是在 liux-centos7 上安装配置
1、官网下载包
https://dev.mysql.com/downloads/repo/yum/
2、安装yum mysql 仓库
[root@localhost ~]# yum install -y https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
#查看yum mysql仓库
[root@www ~]# ls /etc/yum.repos.d/
2.1、如果想使用本地rpm文件,则修改文件 mysql.community.repo文件
[root@localhost ~]# cat /etc/yum.repos.d/
[root@localhost ~]# vim /etc/yum.repos.d/mysql-community.repo
[mysql-connectors-community] name=MySQL Connectors Community baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/ #这里配置成本地文件路径 enabled=1 #1 开启 0关闭 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql # 设置成0不用检查 [mysql-tools-community] name=MySQL Tools Community baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/ #这里配置成本地文件路径 enabled=1 # 1-开启 0-关闭 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql # 设置成0不用检查
3、查看过滤mysql包
[root@localhost ~]# yum list | grep "mysql-community" mysql-community-server.x86_64 5.7.19-1.el7 mysql57-community mysql-community-client.x86_64 5.7.19-1.el7 mysql57-community
4、安装服务端和客户端
[root@localhost ~]# yum install mysql-community-client mysql-community-server -y
或
yum install mysql-community-server
5、启动mysql服务
[root@localhost ~]# systemctl start mysqld
6、登录mysql
#查看密码
[root@localhost ~]# grep ‘temporary password‘ /var/log/mysqld.log
[root@localhost ~]# mysql -uroot -p
Enter password:
7、关闭密码策略以及修改密码 ;详细参考:https://www.cnblogs.com/zhi-leaf/p/5994478.html
[root@localhost ~]# set global validate_password_policy=0;
[root@localhost ~]# set global validate_password_length=1;
[root@localhost ~]# ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456‘;
8、重启服务并登录
[root@localhost ~]# systemctl restart mysqld [root@localhost ~]# mysql -uroot -p Enter password:123456
9、授权远程登录并刷新权限
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘your_root_password‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
10、默认配置文件路径:
配置文件:/etc/my.cnf 日志文件:/var/log//var/log/mysqld.log 服务启动脚本:/usr/lib/systemd/system/mysqld.service socket文件:/var/run/mysqld/mysqld.pid
#(a)数据库目录
/var/lib/mysql/
#(b)配置文件
/usr/share /mysql(mysql.server命令及配置文件)
#(c)相关命令
/usr/bin(mysqladmin mysqldump等命令)
#(d)启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)
如果忘记root密码,则按如下操作恢复
#在[mysqld]的段中加上一句:skip-grant-tables 保存并且退出vi。 mysql -u root update mysql.user set authentication_string=password(‘123qwe‘) where user=‘root‘ and Host = ‘localhost‘; flush privileges
如此文对你有帮助,请打赏作者或推荐此文,在此多谢了~
标签:baseurl sea too min serve mys tools nec my.cnf
原文地址:https://www.cnblogs.com/louby/p/10207310.html