当前位置:网站首页>linux安装mysql
linux安装mysql
2022-07-28 13:48:00 【斗码士】
一个服务的启用少不了数据库的支持,mysql Oracle SQL Server 等等等等
mysql是我工作以来用到最多的数据库,大小公司都在用
MySQL 是由MySQL AB公司(目前已经被SUN公司收归麾下)自主研发的,目前IT行业最流行的开放源代码的数据库管理系统之一,它同时也是一个支持多线程高并发多用户的关系型数据库管理系统。
MySQL是一种关系型数据库管理系统,关系数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性。
好了来说一说我在Centos 7 Linux环境下安装Mysql步骤(注意版本问题)
ps aux|grep mysql
是否存在mysql在运行
rpm -qa | grep mysql再检查mysql是否存在
![]()
有则卸载
rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64 whereis mysql再查询mysql相关目录

rm -rf /usr/bin/mysql /usr/lib64/mysql /usr/local/mysql移除对应的文件夹
好准备工作做的差不多了
cd /usr/local/wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz![]()
这就把mysql下载下来了
tar xzvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz解压
mv mysql-5.7.24-linux-glibc2.12-x86_64 mysql
就出现了一个mysql的目录
cd mysql/
mkdir data
mysql文件夹里面就创建了一个data的文件夹
cd ~
chown -R mysql:mysql /usr/local/mysql
chmod -R 755 /usr/local/mysql添加mysql文件夹所属的用户组和用户,以及权限
cd /usr/local/mysql/bin

./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql初始化mysql就完成了
注意打印出来的日志最末尾 [email protected]:XXXXXXXXXXXXXX后的字符串为mysql管理员临时登录密码。
vi /etc/my.cnf

[mysqld]
datadir=/usr/local/mysql/data
port=3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0
max_connections=600
innodb_file_per_table=1
lower_case_table_names=1
character_set_server=utf8把以上内容加入配置文件就ok
cd ~
/usr/local/mysql/support-files/mysql.server start启动服务
ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
service mysql restartmysql -u root -p
Enter password:
mysql>set password for [email protected] = password('root');
mysql>use mysql;
msyql>update user set user.Host='%' where user.User='root';
mysql>flush privileges;上面命令依次执行 set password for [email protected] = password('root'); 这里的password('root');里面的root 为你想设置的密码
这样mysql就已经成功安装了
边栏推荐
- 8、 Picker usage drop-down box selection effect
- Qt中QTableView设置分页显示的三种方法[通俗易懂]
- 35道MySQL面试必问题图解,这样也太好理解了吧
- @Solution to DS ('slave') multi data source compatible transaction problem
- How did Dongguan Huawei cloud data center become a new model of green data center?
- Hcip day 10
- js的实例化方式
- Another way of understanding the essence of Hamming code
- Revised version | target detection: speed and accuracy comparison (faster r-cnn, r-fcn, SSD, FPN, retinanet and yolov3)
- Leetcode 1331. array sequence number conversion
猜你喜欢

Revised version | target detection: speed and accuracy comparison (faster r-cnn, r-fcn, SSD, FPN, retinanet and yolov3)

如何只降3D相机不降UI相机的分辨率
![[ecmascript6] set and map](/img/64/dd6ffc5f0faf881b990e609cf62343.png)
[ecmascript6] set and map

2022年安全员-A证操作证考试题库模拟考试平台操作

2022 high altitude installation, maintenance, removal of examination question bank and online simulated examination

MySQL development skills - View
![[ecmascript6] async and await](/img/3c/c7de42ad572dc95b188243c02dd228.png)
[ecmascript6] async and await

用友BIP CRM新品发布,赋能大中型企业营销增长

UI开发中所遇到的各种坑
![[Tanabata] Tanabata lonely little frog research edition? The final chapter of Tanabata Festival!](/img/0b/4fc583a3dd4794b0c2b0d64d905be7.png)
[Tanabata] Tanabata lonely little frog research edition? The final chapter of Tanabata Festival!
随机推荐
Realization of chat room function
MiniTest--小程序自动化测试框架
Use of formdata object, VAR formdata=new formdata()
MeterSphere--开源持续测试平台
Many "double first-class" universities have launched the research guarantee and prediction name!
7.27 simulation summary
Qt中QTableView设置分页显示的三种方法[通俗易懂]
Cv:: mat conversion to qimage error
C# 读取ini文件、键值对操作
如何只降3D相机不降UI相机的分辨率
Leetcode 0143. rearrange linked list
十、时间戳
【七夕】七夕孤寡小青蛙究极版?七夕节最终章!
【LeetCode】1331. 数组序号转换
Summarize the knowledge points of the ten JVM modules. If you don't believe it, you still don't understand it
Revised version | target detection: speed and accuracy comparison (faster r-cnn, r-fcn, SSD, FPN, retinanet and yolov3)
9、 Uni popup usage popup effect at the bottom of the drop-down box
Node文件操作
2022高处安装、维护、拆除考试题库及在线模拟考试
As a programmer, how to manage time efficiently?