部署mysql
mysql官方地址:
https://dev.mysql.com/downloads/mysql/
一. 部署数据库mysql5.6
cd /opt
wget https://cdn.mysql.com/archives/mysql-5.6/MySQL-5.6.49-1.el7.x86_64.rpm-bundle.tar
mkdir mysql5.6
tar -xf MySQL-5.6.49-1.el7.x86_64.rpm-bundle.tar -C mysql5.6
cd mysql5.6
yum localinstall ./*
1.安装完成后,检查mysql配置文件,修改一下(不修改启动报错)
cat /etc/my.cnf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 修改 mysqld_safe里面的内容,原本是mariadb,换成mysql [mysqld] datadir= /var/lib/mysql socket= /var/lib/mysql/mysql .sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error= /var/log/mysql/mysql .log pid- file = /var/run/mysql/mysql .pid # # include all files from the config directory # !includedir /etc/my .cnf.d |
1)mysql安装后会出现一个默认随机密码
cat ~/.mysql_secret
# The random password set for the root user at Thu Jan 9 05:33:17 2025 (local time): ozYc0qv5OFIBzcP3
2.启动mysql
systemctl start mysql
systemctl enable mysql
3.修改root密码
方法一:(必须执行这一步,以后修改密码可用方法二)
mysqladmin -uroot -pozYc0qv5OFIBzcP3 password 123456
方法二:(进入mysql修改)
1 2 3 4 5 6 7 8 | # 进入mysql mysql -uroot -p #修改密码 update mysql.user set password=password( '123456' ) where user= 'root' ; # 刷新生效 flush privileges; |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话