一下载mysql对应的包
https://downloads.mysql.com/archives/community/
二。通过winscp复制到linux服务器上并解压到、/usr/local 重命名为mysql
三。修改my.conf配置文件vim /etc/my.cnf
四。初始化数据库进入mysql解压文件夹下的bin目录执行)
./scripts/mysql_install_db --user=mysql
临时密码krCJX4Lzr
先登录连接该用户和默认密码。
五。先登录连接该用户和默认密码。再开一个终端窗口,进入support-files目录,启动mysql.server
./mysql.server start
报错,编辑vim mysql.server
在执行mysqld_safe 时 加入了 --user=root 参数
再次执行成功
参考https://blog.csdn.net/zqin0/article/details/106444580/
六。登录报错access denied for user
编辑/etc/my.cnf 添加skip-grant-tables(可以添加到最后),重新启动mysql服务
重启后成功登录
update更新用户密码,刷新后退出。退出后记得把/etc/my.cnf文件的skip-grant-tables删除、服务重启
登录后还是报错
可能是你在安装 MySQL过程中,通过mysqld --initialize 初始化 mysql 操作后,生成临时密码后,没有直接进行 MySQL连接,中途重启服务或者重启机器等,导致密码失效问题
mysql配置属性查询,语句后添加 \G可以一一对应展示相关属性。
更新为密码登录不过期password_wxpired
安装完成
#启动(二进制方法安装的oracle不适用这个)
systemctl start mysqld
#停止
systemctl stop mysqld
无法启动或停止
find / -name mysql.server
输入查询结果启动
/home/swkj/tools/mysql/mysql-5.7.31-linux-glibc2.12-x86_64/support-files/mysql.server start
建立软连接:第二个参数为创建的软连接名称
取消软连接
rm -rf 创建的软连接名称
修改密码问题。
1。您的密码不符合策略要求
show variables like ‘validate_password%’;查看要求。
设置为只验证长度报错
set persist validate_password.policy=0;
设置长度为4
set persist validate_password.length=0;
2。update mysql.user
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
您的SQL语法有错误;查看与您的MySQL服务器版本相对应的手册,了解正确的语法
3。ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY “root”;
MySQL服务器正在使用–skip grant-tables选项运行,因此无法执行此语句
4。UPDATE user SET password=PASSWORD(‘newpasswd’)WHERE user=’root’;
5.正确语句
安装的mysql不允许本地连接登录
执行语句update user set host=‘%’ where user=‘root’;
登录过程中提示
bash: mysql: command not found
mysql找不到命令
建立软连接:ln -s /usr/local/mysql/bin/mysql /usr/bin
或者在bin 目录下执行
登录后输入密码报错
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
–skip-grant-tables失效时,可以在启动服务时添加;