linux 安装mysql

1 下载mysql 
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.41-linux-glibc2.12-x86_64.tar.gz
2 
groupadd mysql 添加用户组 useradd
-r -g mysql mysql 添加用户 mkdir -p /usr/local/mysql/data/ 创建数据存储目录 chown mysql:mysql -R /usr/local/mysql/data/ 授权数据存储目录 vim /etc/my.cnf 编辑
复制代码
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=basedir=/usr/local/mysql/data/
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/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
复制代码

 

 

 

 

 如果出现上述 初始化错误  需要删除data目录中原有数据

如果出现缺少依赖 需要下载

yum install -y libaio

查看密码
cat /data/mysql/mysql.err

 

直接删除mysql.cnf

重启服务mysql

 

修改mysql密码

use mysql

查看mysql使用plugin

 

 修改密码

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxxxx.';

退出 重新连接

 

posted @   花心大萝卜li  阅读(144)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
点击右上角即可分享
微信分享提示