最新消息:

在阿里云服务器上安装 Ghost (3)– 安装 MySQL

Ghost admin 3236浏览 0评论
Ghost 默认采用 Sqlite3 数据库,但是我还是建议用 MySQL,避免将来由于数据多、访问量多而导致性能下降。

开始安装 MySQL

执行如下指令开始安装 MySQL 吧:

<code>sudo apt-get install mysql-server mysql-client
</code>

由于 MySQL 安装包较大,安装的时间会稍微长一些。安装过程中,系统会提示你给 root 用户(这里的 root 是 MySQL 数据库的管理账号) 设置个密码,建议设置的复杂些,更加安全些。如下图:

af0e426e716719579966c6d8fe56e

加强 MySQL 安全设置

MySQL 安装成功后,我们执行以下指令进一步加强 MySQL 的安全设置:

<code>sudo mysql_secure_installation
</code>

此工具所做的增强安全设置包括:移除所有匿名账户、限制远程 root 账户登录、删除 test 数据库等。下面列出详细设置:

<code>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

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.

//输入安装 MySQL 时为 root 账户设置的密码
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 MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

//是否修改 root 账户的密码?前面设置过 root 账户的密码了,如果不打算修改密码的话,输入 'n'
Change the root password? [Y/n] n
 ... skipping.

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!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

//是否禁止 root 账户远程登录?
Disallow root login remotely? [Y/n] y
 ... Success!

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.

//是否删除 MySQL 默认创建的 test 数据库,并删除所有对 test 数据库的权限设置?
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 MySQL
installation should now be secure.

Thanks for using MySQL!
</code>

OK!MySQL 到此就安装好了!

转载请注明:爱开源 » 在阿里云服务器上安装 Ghost (3)– 安装 MySQL

您必须 登录 才能发表评论!