Mysql8.x: mysql8.x: mysql8.x: mysql8.x: mysql8.x: mysql8.x: mysql8.x

Navicat error: 2003 – Can’t connnect to mysql Server on unknown error

The solution

  1. Set the password
(1). By default, password is required to log in to MySQL 8, but password is not set at the beginning of MySQL 8, so you need to add skip-grant-tables=1 to the configuration file vi /etc/my.cnfCopy the code

(2). Skip the password and log in with the flush PRIVILEGES command; Refresh privileges' '$: Flush PRIVILEGES; (3). Set a complex password, otherwise simple passwords will not pass $: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Dlb19901214%'; /etc/my.cnf skip-grant-tables=1 (5) $:service mysqld restartCopy the code
  1. Configure extranet access
$:mysql -u root -p ' '(2) $:use mysql; $: update user set host='%' where user='root'; Grant all PRIVILEGES on *.* to 'privileges '@'%' with grant option; (5). Finally refresh privileges' '$: Flush PRIVILEGES; ` ` `Copy the code