mysql5.7;8.0

5.7:

1、RROR 1130 (HY000): Host 'XXXX' is not allowed to connect to this MySQL server(默认值允许本地登录)

mysql -u root -pvmware
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>flush privileges;
mysql>select host, user from user;

mysql>quit

2、ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.(密码过期/改密码)

mysqld --skip-grant-tables 

 > mysql(bin目录)

 > use mysql;

 > UPDATE user SET `password_expired`='N' where user='root';

 > UPDATE user SET `authentication_string` = PASSWORD('root');

(password_expired-----Y -> 密码过期; N -> 密码不过期;)

(authentication_string----这个字段是MySQL5.7版本的密码字段、由之前的password变为authentication_string)

 > flush privileges;

flush privileges 命令本质上的作用是将当前user和privilige表中的

用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里;

 >quit; / exit;

3、初始化:

1.mysqld --initialize --console这时会在控制台输出一个临时密码,把它存储起来
2.mysqld install 安装mysql
3.net start mysql 启动mysql服务
4.mysql -uroot -p 登陆
5.password 密码
6.alter user 'root'@'localhost' identified by 'root';改密码
quit

4、启动报错:TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS

skip-name-resolve                    

skip-external-locking                

#enable-named-pipe 

# skip-networking 

mysql8.0

1、与5.7不同:

mysqld --console --skip-grant-tables --shared-memory

>mysql

>use mysql;

>update user set authentication_string='' where user='root'

>ALTER user 'root'@'localhost' IDENTIFIED BY 'Cliu123#'

2、mysqld --initialize-insecure --user=mysql

mysqld -install

mysql> select host,user,authentication_string from mysql.user;

host: 允许用户登录的ip‘位置'%表示可以远程;

user:当前数据库的用户名;

authentication_string: 用户密码(后面有提到此字段);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值