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: 用户密码(后面有提到此字段);