当前位置:网站首页>How to Install MySQL on Linux
How to Install MySQL on Linux
2022-07-31 08:29:00 【bsegebr】
Directory
Start installation
1. Create a mysql file installation directory
mkdir /opt/mysql
Enter this directory
cd /opt/mysql/
2. Install mysql
wget http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
Unzip the file
tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
3. Delete the built-in database mariadb (if there is one on the virtual machine, no matter if it is not), it will conflict with mysql.
First execute the following command to see if it exists
rpm -qa | grep mari
If it exists, execute the following commands in sequence to delete
rpm -e --nodeps mariadb-libsrpm -e --nodeps marisa
4. Start installing mysql and execute the following commands in sequence
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpmrpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpmrpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpmrpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
Note: When executing the last command, an error may be reported:
Solution: Execute the command to install libaio
yum install libaio
Then execute the command again
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
5. Start mysql
systemctl start mysqld.service
6.mysql automatically sets a random password for the root user, run the command to view the current password
grep "password" /var/log/mysqld.log
7. Use the password found above to enter mysql
mysql -u root -p
8. Modify the password, and then execute the following command to make the password setting take effect (the local virtual machine can be set simpler, ECS recommends setting a complex password, and personally experience the database on the laboratory server being hacked)
set password for 'root'@'localhost'=password('root');flush privileges;
Test if the installation was successful
Exit mysql and enter with the reset password
exit
At this time, if you use Navicat to connect to the serverThe database may fail
ECS please enter the security group to open port 3306, the local virtual machine does not need to worry about this problem
If the port has been opened, the problem may be as follows:
Solution:
First enter mysql on the virtual machine, and then execute the following commands in sequenceuse mysql;
SELECT Host, User FROM user;
UPDATE userSET Host = '%' WHERE User = 'root';
flush privileges;
Then reconnect with Navicat again.
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
猜你喜欢
深度理解递归,手撕经典递归问题(汉诺塔,青蛙跳台阶),保姆级教学。
Calculation example of matlab program iEEE9 node system for power flow calculation of AC-DC hybrid system based on alternate iteration method
MySQL installation to the last step in the write the configuration file failed?And after the installation steps
关于“算力”,这篇文章值得一看
MySQL detailed explanation
如何在 Linux 上安装 MySQL
Thread 类的基本用法——一网打尽
SSM框架讲解(史上最详细的文章)
sqlmap使用教程大全命令大全(图文)
First acquaintance with NK-RTU980 development board
随机推荐
Navicat new database
【小程序项目开发-- 京东商城】uni-app之商品列表页面 (上)
2022杭电杯超级联赛3
一文读懂Elephant Swap,为何为ePLATO带来如此高的溢价?
蚂蚁核心科技产品亮相数字中国建设峰会 持续助力企业数字化转型
"The C language games" mine clearance
MySQL 5.7详细下载安装配置教程
功能强大的国产Api管理工具
个人报错问题 持续总结
安装部署KubeSphere管理kubernetes
深度理解递归,手撕经典递归问题(汉诺塔,青蛙跳台阶),保姆级教学。
MySQL installation to the last step in the write the configuration file failed?And after the installation steps
Vscode:Project-tree插件
信息收集-DNS
普通函数的参数校验
中软国际携手深开鸿发布(1+1) x N 战略,以数字化、智慧化改变人类生产和生活方式
SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)
Spark 在 Yarn 上运行 Spark 应用程序
MySQL 5.7 安装教程(全步骤、保姆级教程)
日志导致线程Block的这些坑,你不得不防