当前位置:网站首页>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就已经成功安装了
边栏推荐
- ZABBIX distributed
- [ecmascript6] modularization
- BGP experiment
- Excel VBA 免密查看VBE加密代码
- JS instantiation method
- Daily question - Scholarship
- Database optimization understanding these is enough
- [translation] salt companies come to linkerd for load balancing, and stay for efficiency, reliability and performance
- 围绕新市民金融聚焦差异化产品设计、智能技术提效及素养教育
- What is gossip (E-Net gossip)
猜你喜欢

Daily question - Scholarship

十、时间戳

Copy excel row to specified row

文件批量重命名工具Bulk Rename Utility

九、uni-popup用法 下拉框底部弹窗效果

Foundation of deep learning ---- GNN spectral domain and airspace (continuous improvement, update and accumulation)
Excel VBA 开发过程中遇到的一些问题,解决方案,持续更新

Forage QR code -- online QR code generator

HCIP第十一天

OKR与GRAD
随机推荐
[ecmascript6] iterator and generator
如何让照片中的人物笑起来?HMS Core视频编辑服务一键微笑功能,让人物笑容更自然
C语言实现简单学生成绩管理系统的方法
Leetcode 0143. rearrange linked list
实时切换 Core Data 的云同步状态
[ecmascript6] class
468 product planning and promotion plan (150 copies)
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
Afnetworking crash course
QQ robot configuration record based on nonebot2
Target detection: speed and accuracy comparison (fater r-cnn, r-fcn, SSD, FPN, retinanet and yolov3)
企鹅一面:为什么不建议使用SELECT * ?
TDengine 助力西门子轻量级数字化解决方案
草料二维码--在线二维码生成器
MeterSphere--开源持续测试平台
How to effectively conduct the review meeting (Part 1)?
Many "double first-class" universities have launched the research guarantee and prediction name!
[ecmascript6] modularization
FormData对象的使用, var formdata=new FormData()
Hcip day 12