当前位置:网站首页>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就已经成功安装了
边栏推荐
- [ecmascript6] async and await
- 八、picker用法 下拉框选择效果
- Floating point data type in C language (did you learn to waste it)
- 多线程顺序运行有几种方法?
- Hcip day 11
- 天气这么热太阳能发电不得起飞喽啊?喽啊个头……
- 2022低压电工考试题及答案
- SwiftUI 的动画机制
- When Xcode writes swiftui code, it is a small trap that compiles successfully but causes the preview to crash
- SwiftUI 布局 —— 尺寸( 上 )
猜你喜欢

如何有效进行回顾会议(上)?

Raspberry pie foundation | summarize and record some operations in the learning process of raspberry pie

Install mysql5.7.36 in CentOS

Tdengine helps Siemens' lightweight digital solutions

MySQL development skills - View

Many "double first-class" universities have launched the research guarantee and prediction name!

手机滚动截屏软件推荐

Summarize the knowledge points of the ten JVM modules. If you don't believe it, you still don't understand it
![[线程安全问题] 多线程到底可能会带来哪些风险?](/img/79/112ab7e586b0bceb296dfddb2728be.png)
[线程安全问题] 多线程到底可能会带来哪些风险?
![[ecmascript6] set and map](/img/64/dd6ffc5f0faf881b990e609cf62343.png)
[ecmascript6] set and map
随机推荐
[ecmascript6] class
Analysis of thrift serialization protocol
【七夕】七夕孤寡小青蛙究极版?七夕节最终章!
9、 Uni popup usage popup effect at the bottom of the drop-down box
爆肝整理JVM十大模块知识点总结,不信你还不懂
C # read INI file and key value pair operation
UFIDA BiP CRM new product launch enables large and medium-sized enterprises to grow their marketing
Copy excel row to specified row
一些企业数据平台建设的思考
Summarize the knowledge points of the ten JVM modules. If you don't believe it, you still don't understand it
Qt中QTableView设置分页显示的三种方法[通俗易懂]
OKR and grad
Tdengine helps Siemens' lightweight digital solutions
468产品策划与推广方案(150份)
2022年安全员-A证操作证考试题库模拟考试平台操作
软件测试的发展与定义
C语言库函数getchar()怎么使用
2022年熔化焊接与热切割考题及在线模拟考试
C# 获取当前路径7种方法
pix2pix