centos7设置官方yum安装mysql8
千行网址导航:http://www.qianxingweb.com
1.打开mysql官网 https://www.mysql.com/ 点击【 DOWNLOAD】 看到有导航【yum response】=》点击下载
2.点击下图的链接下载
3.下在完后回到【yum response】页面点击【A Quick Guide to Using the MySQL Yum Repository】打开后在当前页面找到=》【Adding the MySQL Yum Repository】按照提示执行
rpm -Uvh xxx.rpm
yum repolist all | grep mysql
yum-config-manager --disable mysql80-community
若要安装对指定版本的,需要确认 /etc/yum.repos.d/mysql-community.repo 文件中对应的版本的enabled=1。确认后,执行
yum install mysql-community-server
安装完后启动mysql:
service mysqld start
查看mysqld是否是开机启动:【;enabled;】表明开机启动
systemctl status mysqld
后面按照官网的指导文件进行设置即可:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
=====================================================================================
4.win下在mysql解压文件安装
4.1 /bin目录以cmd管理员权限执行:
mysqld --initialize --user=mysql --console
最后面的时生成的临时密码
4.2.下面错误是因为没有权限,cmd选择管理员模式
重新执行
启动登录后需要立即执行修改密码操作:
set password = password('root');
//允许远程访问(mysql8无效)
1.选择数据库 use mysql 2.新建用户远程连接mysql数据库 grant all on *.* to root@'%' identified by 'root' with grant option; flush privileges; 3.支持root用户允许远程连接mysql数据库 grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option; flush privileges; 4.查看系统用户 select user,host from user;
//设置允许远程访问mysql8及navicat可以连接
1.创建一个远程访问的用户:(use mysql后操作)
create user '用户名'@'%' identified by '访问密码'
2.修改验证这个账户登录密码的方式为:mysql_native_password
alter user '用户名'@'%' identified with mysql_native_password by '上面创建时的访问密码'
3.授权指定数据库访问权限
grant all privileges on 数据库名称.* to '用户名'@'%' with grant option;
4.刷新
flush privileges;
千行网址导航:http://www.qianxingweb.com