surroundings:
centos 7.5 mysql version 5.5
1) Download the database
[root@hya ~]# yum -y install mariadb mariadb-server
[root@hya ~]# rpm -qa mariadb-*
mariadb-libs-5.5.65-1.el7.x86_64
mariadb-server-5.5.65-1.el7.x86_64
2) Start the database and set a password
[root@hya ~]# systemctl start mariadb
[root@hya ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *:3306 *:*
[root@hya ~]# mysqladmin -uroot password 'hya123';
或者也可以
##################################################
mysql> use mysql;
mysql> update user set password=PASSWORD('hya123') where user='root';
mysql> flush privileges;
####################