mysql_secure_installation回车 这里需要注意的是,如果你是新安装的mysql,会弹出如下提示:
In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, 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):
大概意思就是如果你是新安装的话,你的默认密码是空,直接按enter键就可以了
然后设置新的密码,输入两次。
再然后,会有若干个提示:
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL 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] y
... Success!
大概意思是,mysql会默认创建一个匿名用户,方便你测试什么的,现在问你要不要删掉它,果断删掉
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
... Success!
大概意思是,root用户默认只能访问localhost,以防止有人猜你的密码。。。问你是否禁止root登陆,也选yes,虽然基本上不会有人来猜吧。。。
By default, MySQL 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] y
大概意思是,mysql默认创建了一个名为test的数据库,这个库任何人都可以访问,问你是不是要把它删掉,也删掉。
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
大概意思是,上面所有的修改是否马上生效,选y
总之就是一路Yes。。。。
最后出现:Thanks for using MySQL!
MySql密码设置完成,重新启动 MySQL:
/etc/init.d/mysqld restart #重启