当前位置:网站首页>Install MySQL for Linux (package succeeded!!)

Install MySQL for Linux (package succeeded!!)

2022-06-22 22:01:00 kjshuan

1. install wget

yum install -y wget

2. Backup

cd /etc/yum.repos.d/

mv CentOS-Base.repo CentOS-Base.repo_bak

3. Replace Alibaba cloud yum Source

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4. eliminate YUM Cache and build cache

yum clean all

yum makecache

5. Inquire about mariadb And uninstall

rpm -qa | grep mariadb

rpm -e --nodeps mariadb-libs-5.5.65-1.el7.x86_64( Copy the current environment mysql Watch yourself mariadb Version of

6. download mysql Of repo Source and install rpm package

cd /opt/

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

rpm -ivh mysql-community-release-el7-5.noarch.rpm

7. install mysql

yum install mysql-server -y

8. Grant authority

chown -R root:root /var/lib/mysql

chown root /var/lib/mysql/

9. restart mysql database

service mysqld restart

10. Sign in mysql Database and authorize

mysql -u root -p
​
use mysql
​
update user set Password = password('ok') where User='root';
​
GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY "ok";

11. Validate configuration and exit

flush privileges;

exit

12. install vim And set the character set

yum install -y vim

vim /etc/my.cnf

add to

character-set-server=utf8

13. restart mysql

service mysqld restart

14. Sign in mysql database

mysql -uroot -pok

原网站

版权声明
本文为[kjshuan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206222023586657.html