[root@localhost usr]# yum install mariadb mariadb-server #这是安装nariadb和mariadb服务
[root@localhost usr]# systemctl start mariadb.service
Set root password? [Y/n] y #这里选择Y是否重新设置密码
New password: #新密码
Re-enter new password: #重复新密码
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] n #是否清楚其他用户的意思吧
... skipping.
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n #是否禁止远程访问
... skipping.
Remove test database and access to it? [Y/n] y #是否删除测试数据
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y #是否重置权限
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
#这里就完成了
#下面重启一下mariadb服务和apache服务
[root@localhost usr]# systemctl restart mariadb.service
[root@localhost usr]# systemctl restart httpd.service
[root@localhost usr]# mysql -u root -p #登录看一下是否成功
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.47-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select user,password,host from user;
+------+-------------------------------------------+-----------------------+
| user | password | host |
+------+-------------------------------------------+-----------------------+
| root | *DB469070DB0AD0CA0B93040D166D7FC4713D6961 | localhost |
| root | *DB469070DB0AD0CA0B93040D166D7FC4713D6961 | localhost.localdomain |
| root | *DB469070DB0AD0CA0B93040D166D7FC4713D6961 | 127.0.0.1 |
| root | *DB469070DB0AD0CA0B93040D166D7FC4713D6961 | ::1 |
| | | localhost |
| | | localhost.localdomain |
+------+-------------------------------------------+-----------------------+
6 rows in set (0.00 sec)
MariaDB [mysql]> grant all privileges on *.* to root@"%" identified by "1q2w3e4r";
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> flush privileges; #提交Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> quit 退出Bye
[root@localhost usr]# systemctl stop mariadb.service #停止服务
[root@localhost usr]# ps aux|grep mariadb #看一下mariadb服务是否停止如下已停止root 2899 0.0 0.0 112664 980 pts/0 S+ 19:01 0:00 grep --color=auto mariadb[
root@localhost usr]# systemctl start mariadb #启动赶快本地用navcat连接试一下