ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Mysql8.0安装

2022-03-25 01:01:47  阅读:230  来源: 互联网

标签:root ERROR Server etc Mysql8.0 mysql mysqld 安装


Mysql安装

安装:忘记咋安装了,反正安装的版本是8.0.25
出现了以下问题 mark一下:

  1. 启动失败,先去确认启动失败,查看端口起来没:
lsof -i 3306
  1. 如果没有,则查看mysql的状态:
service mysqld status
  1. 当发现启动失败,即出现failed to start mysql的文段,
  2. 先重启看看:
systemctl restart mysqld.service
  1. 执行journalctl -xe查看文档。报错:
Failed to start MySQL Server.
Unit mysqld.service entered failed state.
  1. 根据博客
# 修改/etc/my.cnf的datadir配置项
# 默认的是:

datadir=/var/lib/mysql
# 在 /var/lib/mysql创建个data目录 datadir改成
datadir=/var/lib/mysql/data
  1. 再次登录发现,不记得密码,具体现象如下:
[root@VM-4-17-centos etc]# sudo mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@VM-4-17-centos etc]# sudo mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@VM-4-17-centos etc]# sudo mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@VM-4-17-centos etc]# sudo mysql 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@VM-4-17-centos etc]# mysqld -console --skip-grant-tables --shared-memory
2022-03-24T16:21:51.399204Z 0 [System] [MY-010116] [Server] /usr/local/mysql-8.0/bin/mysqld (mysqld 8.0.25) starting as process 24925
2022-03-24T16:21:51.402833Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2022-03-24T16:21:51.402893Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-03-24T16:21:51.403171Z 0 [System] [MY-010910] [Server] /usr/local/mysql-8.0/bin/mysqld: Shutdown complete (mysqld 8.0.25)  MySQL Community Server - GPL.
[root@VM-4-17-centos etc]# mysqld 
2022-03-24T16:22:05.531085Z 0 [System] [MY-010116] [Server] /usr/local/mysql-8.0/bin/mysqld (mysqld 8.0.25) starting as process 24975
2022-03-24T16:22:05.534526Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2022-03-24T16:22:05.534577Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-03-24T16:22:05.534798Z 0 [System] [MY-010910] [Server] /usr/local/mysql-8.0/bin/mysqld: Shutdown complete (mysqld 8.0.25)  MySQL Community Server - GPL.
[root@VM-4-17-centos etc]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service

再看发现Mysql8.0默认生成随机密码,然后你进去需要修改密码,先去日志找密码:

find / -name mysqld.log
cd /var/log/
cat mysqld.log 

根据密码登陆,然后修改密码:

# ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
alter user user() identified by '123456';
# ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
alter user user() identified by '?????';

修改密码完成。 成功可以登陆

其他问题

由于Mysql在有时会出现mysql.sock定位误差,会造成不连接数据库。
mac由当时的误差:
第一个变化my.cnf
位置/etc/my.cnf下一个,如果没有,那么。跟/usr/locate/mysql号/my.cnf下改动,然后拷贝到/etc下。
改动为例如以下:

[client]
socket = /tmp/mysql.sock
[mysqld]
socket = /tmp/mysql.sock

没有[client]的话。自己加入~

标签:root,ERROR,Server,etc,Mysql8.0,mysql,mysqld,安装
来源: https://www.cnblogs.com/SsoZhNO-1/p/16052829.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有