Centos7下MySQL 8.0 安装相关基础问题
-
yum -y install mysql mysql-server- 提示已经安装mariadb 不再安装mysql
- 提示没有在yum 库中找到mysql-server :
- 需要首先从mysql官网下载npm包到本地:
wget https://mysql.com/get/mysql**-community-release*****.noarch.rpm(具体的mysql版本),参见mysql 官方yum库 yum install mysql**-community-release*****.noarch.rpmyum install mysql-server
- 需要首先从mysql官网下载npm包到本地:
-
确认mysqld服务是否正确运行。尝试登陆时,若异常可能报错
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'-
查看mysql 3306端口是否打开:
lsof -i:3306或者netstat -ntpl |grep 3306 -
查看mysql服务是否启动
service mysqld status或者systemctl status mysqld -
若上述报错,确认
/etc/init.d目录下是否含有msyqld服务(init.d 目录中存放的是一系列系统服务的管理(启动或停止)脚本),若没有- 使用
find / -name msyqld - 将上述找到的目录 复制到
/etc/init.d下 - 重启mysql 服务
systemctl restart msyqld,systemctl status mysqld
- 使用
-
初次使用root用户以空密码登陆时报错
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)参考链接-
原因:root用户空密码只适用于5.7以下版本
-
对于5.7以上的版本
The superuser account 'root'@'localhost' is created. The password for the superuser is set and stored in the error log file
查看方法
grep 'temporary password' /var/log/mysqld.log
-
-
-
首次成功登陆后修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass5!'