[root@system1 ~]# mysql_secure_installation #设置数据库
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): #因为以前没密码,直接回车即可
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y #是否设置root密码 —— y
New password: #自定义
Re-enter new password: # 自定义
Password updated successfully!
Reloading privilege tables…
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] #是否删除匿名用户,默认回车即可
… Success!
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] y #是否拒绝root远程登陆——y,这样就只能localhost登陆了
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] #删除测试数据库访问他,默认回车即可
- 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] #是否现在重新加载权限表,默认回车即可
… 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!
基本配置就完成了
登陆mysql语法:
mysql -u用户名 -p当前密码 -h服务器的ip
(客户端才需要指定ip,并且服务端需要配置)【登陆当前服务器,不需要-h】
记住:选项和后面的值是没有空格的
- 不需要指定用户和么有密码直接输入mysql ,进入mysql的子系统:
在mysql中即可执行若干命令;
查看mysq详细
status
命令结尾说明
注:在mysql提示符下敲命令的时候,一般都要以;
或者\G
结束,更多的时候使用 ;
结束,\G
一般用户格式化输出,如果没有以 ;
结束的话,系统就会认为命令没有完成,不执行。 凡事以#
或者--
开头的语句,都认为是注释。
- 以
;
结尾
- 以
\G
结尾(会格式化并排版)
所以如果命令太长的话,可以任意的换行。