1.通过修改配置文件,无密码登录
mysql的配置文件在/etc/my.cnf
[root@bogon ~]# vim /etc/my.cnf
在[mysqld]中添加:skip-grant-tables
[mysqld]
skip-grant-tables
重启MySQL|mariadb服务
[root@bogon ~]# systemctl restart mariadb
登录MySQL|mariadb
[root@bogon ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>