Centos6.5

1.首先我们需要检测系统是否自带安装mysql

# yum list installed | grep mysql

2.如果发现有系统自带mysql,果断这么干

# yum -y remove mysql-libs.x86_64

[root@localhost ~]# yum -y remove mysql-libs.x86_64
Loaded plugins: fastestmirror, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be erased
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Running transaction check
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be erased
--> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-12.el6.x86_64
--> Running transaction check
---> Package cronie.x86_64 0:1.4.4-12.el6 will be erased
--> Processing Dependency: cronie = 1.4.4-12.el6 for package: cronie-anacron-1.4.4-12.el6.x86_64
---> Package redhat-lsb-core.x86_64 0:4.0-7.el6.centos will be erased
--> Processing Dependency: redhat-lsb-core for package: libcgroup-0.40.rc1-5.el6.x86_64
--> Processing Dependency: redhat-lsb-core(x86-64) = 4.0 for package: redhat-lsb-printing-4.0-7.el6.centos.x86_64
--> Processing Dependency: redhat-lsb-core(x86-64) = 4.0-7.el6.centos for package: redhat-lsb-4.0-7.el6.centos.x86_64
--> Processing Dependency: redhat-lsb-core(x86-64) = 4.0 for package: redhat-lsb-graphics-4.0-7.el6.centos.x86_64
--> Running transaction check
---> Package cronie-anacron.x86_64 0:1.4.4-12.el6 will be erased
---> Package libcgroup.x86_64 0:0.40.rc1-5.el6 will be erased
--> Processing Dependency: libcgroup for package: numad-0.5-9.20130814git.el6.x86_64
---> Package redhat-lsb.x86_64 0:4.0-7.el6.centos will be erased
--> Processing Dependency: redhat-lsb(x86-64) = 4.0-7.el6.centos for package: redhat-lsb-compat-4.0-7.el6.centos.x86_64
---> Package redhat-lsb-graphics.x86_64 0:4.0-7.el6.centos will be erased
---> Package redhat-lsb-printing.x86_64 0:4.0-7.el6.centos will be erased
--> Running transaction check
---> Package numad.x86_64 0:0.5-9.20130814git.el6 will be erased
---> Package redhat-lsb-compat.x86_64 0:4.0-7.el6.centos will be erased
--> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch
--> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-22.el6.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be erased
---> Package sysstat.x86_64 0:9.0.4-22.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================
 Package                       Arch             Version                          Repository                                          Size
==========================================================================================================================================
Removing:
 mysql-libs                    x86_64           5.1.71-1.el6                     @anaconda-CentOS-201311272149.x86_64/6.5           4.0 M
Removing for dependencies:
 cronie                        x86_64           1.4.4-12.el6                     @anaconda-CentOS-201311272149.x86_64/6.5           174 k
 cronie-anacron                x86_64           1.4.4-12.el6                     @anaconda-CentOS-201311272149.x86_64/6.5            43 k
 crontabs                      noarch           1.10-33.el6                      @anaconda-CentOS-201311272149.x86_64/6.5           2.4 k
 libcgroup                     x86_64           0.40.rc1-5.el6                   @anaconda-CentOS-201311272149.x86_64/6.5           321 k
 numad                         x86_64           0.5-9.20130814git.el6            @anaconda-CentOS-201311272149.x86_64/6.5            56 k
 postfix                       x86_64           2:2.6.6-2.2.el6_1                @anaconda-CentOS-201311272149.x86_64/6.5           9.7 M
 redhat-lsb                    x86_64           4.0-7.el6.centos                 @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 redhat-lsb-compat             x86_64           4.0-7.el6.centos                 @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 redhat-lsb-core               x86_64           4.0-7.el6.centos                 @anaconda-CentOS-201311272149.x86_64/6.5            22 k
 redhat-lsb-graphics           x86_64           4.0-7.el6.centos                 @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 redhat-lsb-printing           x86_64           4.0-7.el6.centos                 @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 sysstat                       x86_64           9.0.4-22.el6                     @anaconda-CentOS-201311272149.x86_64/6.5           824 k

Transaction Summary
==========================================================================================================================================
Remove       13 Package(s)

Installed size: 15 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : redhat-lsb-compat-4.0-7.el6.centos.x86_64                                                                             1/13 
  Erasing    : redhat-lsb-4.0-7.el6.centos.x86_64                                                                                    2/13 
  Erasing    : redhat-lsb-graphics-4.0-7.el6.centos.x86_64                                                                           3/13 
  Erasing    : redhat-lsb-printing-4.0-7.el6.centos.x86_64                                                                           4/13 
  Erasing    : sysstat-9.0.4-22.el6.x86_64                                                                                           5/13 
  Erasing    : numad-0.5-9.20130814git.el6.x86_64                                                                                    6/13 
  Erasing    : libcgroup-0.40.rc1-5.el6.x86_64                                                                                       7/13 
  Erasing    : redhat-lsb-core-4.0-7.el6.centos.x86_64                                                                               8/13 
  Erasing    : crontabs-1.10-33.el6.noarch                                                                                           9/13 
/var/tmp/rpm-tmp.iPfGhN: line 1: lsb_release: command not found
  Erasing    : cronie-anacron-1.4.4-12.el6.x86_64                                                                                   10/13 
  Erasing    : cronie-1.4.4-12.el6.x86_64                                                                                           11/13 
  Erasing    : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                                     12/13 
  Erasing    : mysql-libs-5.1.71-1.el6.x86_64                                                                                       13/13 
  Verifying  : redhat-lsb-printing-4.0-7.el6.centos.x86_64                                                                           1/13 
  Verifying  : cronie-anacron-1.4.4-12.el6.x86_64                                                                                    2/13 
  Verifying  : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                                      3/13 
  Verifying  : numad-0.5-9.20130814git.el6.x86_64                                                                                    4/13 
  Verifying  : redhat-lsb-4.0-7.el6.centos.x86_64                                                                                    5/13 
  Verifying  : redhat-lsb-core-4.0-7.el6.centos.x86_64                                                                               6/13 
  Verifying  : redhat-lsb-compat-4.0-7.el6.centos.x86_64                                                                             7/13 
  Verifying  : mysql-libs-5.1.71-1.el6.x86_64                                                                                        8/13 
  Verifying  : crontabs-1.10-33.el6.noarch                                                                                           9/13 
  Verifying  : libcgroup-0.40.rc1-5.el6.x86_64                                                                                      10/13 
  Verifying  : sysstat-9.0.4-22.el6.x86_64                                                                                          11/13 
  Verifying  : cronie-1.4.4-12.el6.x86_64                                                                                           12/13 
  Verifying  : redhat-lsb-graphics-4.0-7.el6.centos.x86_64                                                                          13/13 

Removed:
  mysql-libs.x86_64 0:5.1.71-1.el6                                                                                                        

Dependency Removed:
  cronie.x86_64 0:1.4.4-12.el6                   cronie-anacron.x86_64 0:1.4.4-12.el6           crontabs.noarch 0:1.10-33.el6             
  libcgroup.x86_64 0:0.40.rc1-5.el6              numad.x86_64 0:0.5-9.20130814git.el6           postfix.x86_64 2:2.6.6-2.2.el6_1          
  redhat-lsb.x86_64 0:4.0-7.el6.centos           redhat-lsb-compat.x86_64 0:4.0-7.el6.centos    redhat-lsb-core.x86_64 0:4.0-7.el6.centos 
  redhat-lsb-graphics.x86_64 0:4.0-7.el6.centos  redhat-lsb-printing.x86_64 0:4.0-7.el6.centos  sysstat.x86_64 0:9.0.4-22.el6             

Complete!

再查看一下,发现已经删除

3.随便在你存放文件的目录下执行,这里解释一下,由于这个mysql的yum源服务器在国外,所以下载速度会比较慢,还好

mysql5.6只有79M大,而mysql5.7就有182M了,所以这是我不想安装mysql5.7的原因

# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

4.接着执行这句,解释一下,这个rpm还不是mysql的安装文件,只是两个yum源文件,执行后,在/etc/yum.repos.d/ 这个目录下多出mysql-community-source.repo和mysql-community.repo

# rpm -ivh mysql-community-release-el6-5.noarch.rpm

5.这个时候,可以用yum repolist mysql这个命令查看一下是否已经有mysql可安装文件

#yum repolist all | grep mysql

6.安装mysql 服务器命令(一路yes):

# yum install mysql-community-server

[root@localhost ~]# yum install mysql-community-server
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: centos.ustc.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.39-2.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.39-2.el6 for package: mysql-community-server-5.6.39-2.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.39-2.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.6.39-2.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.39-2.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.6.39-2.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.6.39-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================
 Package                                 Arch                    Version                         Repository                          Size
==========================================================================================================================================
Installing:
 mysql-community-server                  x86_64                  5.6.39-2.el6                    mysql56-community                   55 M
Installing for dependencies:
 mysql-community-client                  x86_64                  5.6.39-2.el6                    mysql56-community                   18 M
 mysql-community-common                  x86_64                  5.6.39-2.el6                    mysql56-community                  308 k
 mysql-community-libs                    x86_64                  5.6.39-2.el6                    mysql56-community                  1.9 M

Transaction Summary
==========================================================================================================================================
Install       4 Package(s)

Total download size: 75 M
Installed size: 336 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): mysql-community-client-5.6.39-2.el6.x86_64.rpm                                                              |  18 MB     00:05     
(2/4): mysql-community-common-5.6.39-2.el6.x86_64.rpm                                                              | 308 kB     00:00     
(3/4): mysql-community-libs-5.6.39-2.el6.x86_64.rpm                                                                | 1.9 MB     00:00     
(4/4): mysql-community-server-5.6.39-2.el6.x86_64.rpm                                                              |  55 MB     00:48     
------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                     1.4 MB/s |  75 MB     00:54     
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
 Package: mysql-community-release-el6-5.noarch (installed)
 From   : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-5.6.39-2.el6.x86_64                                                                             1/4 
  Installing : mysql-community-libs-5.6.39-2.el6.x86_64                                                                               2/4 
  Installing : mysql-community-client-5.6.39-2.el6.x86_64                                                                             3/4 
  Installing : mysql-community-server-5.6.39-2.el6.x86_64                                                                             4/4 
  Verifying  : mysql-community-server-5.6.39-2.el6.x86_64                                                                             1/4 
  Verifying  : mysql-community-client-5.6.39-2.el6.x86_64                                                                             2/4 
  Verifying  : mysql-community-common-5.6.39-2.el6.x86_64                                                                             3/4 
  Verifying  : mysql-community-libs-5.6.39-2.el6.x86_64                                                                               4/4 

Installed:
  mysql-community-server.x86_64 0:5.6.39-2.el6                                                                                            

Dependency Installed:
  mysql-community-client.x86_64 0:5.6.39-2.el6  mysql-community-common.x86_64 0:5.6.39-2.el6  mysql-community-libs.x86_64 0:5.6.39-2.el6 

Complete!

7.安装成功后

# service mysqld start

[root@localhost ~]# service mysqld start
初始化 MySQL 数据库: 2018-04-12 01:38:42 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-12 01:38:42 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-04-12 01:38:42 0 [Note] /usr/sbin/mysqld (mysqld 5.6.39) starting as process 25937 ...
2018-04-12 01:38:42 25937 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-04-12 01:38:42 25937 [Note] InnoDB: The InnoDB memory heap is disabled
2018-04-12 01:38:42 25937 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-12 01:38:42 25937 [Note] InnoDB: Memory barrier is not used
2018-04-12 01:38:42 25937 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-04-12 01:38:42 25937 [Note] InnoDB: Using Linux native AIO
2018-04-12 01:38:42 25937 [Note] InnoDB: Using CPU crc32 instructions
2018-04-12 01:38:42 25937 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-04-12 01:38:42 25937 [Note] InnoDB: Completed initialization of buffer pool
2018-04-12 01:38:42 25937 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2018-04-12 01:38:42 25937 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2018-04-12 01:38:42 25937 [Note] InnoDB: Database physically writes the file full: wait...
2018-04-12 01:38:42 25937 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2018-04-12 01:38:43 25937 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2018-04-12 01:38:44 25937 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-04-12 01:38:44 25937 [Warning] InnoDB: New log files created, LSN=45781
2018-04-12 01:38:44 25937 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-04-12 01:38:44 25937 [Note] InnoDB: Doublewrite buffer created
2018-04-12 01:38:44 25937 [Note] InnoDB: 128 rollback segment(s) are active.
2018-04-12 01:38:44 25937 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-04-12 01:38:44 25937 [Note] InnoDB: Foreign key constraint system tables created
2018-04-12 01:38:44 25937 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-04-12 01:38:44 25937 [Note] InnoDB: Tablespace and datafile system tables created.
2018-04-12 01:38:44 25937 [Note] InnoDB: Waiting for purge to start
2018-04-12 01:38:44 25937 [Note] InnoDB: 5.6.39 started; log sequence number 0
2018-04-12 01:38:45 25937 [Note] Binlog end
2018-04-12 01:38:45 25937 [Note] InnoDB: FTS optimize thread exiting.
2018-04-12 01:38:45 25937 [Note] InnoDB: Starting shutdown...
2018-04-12 01:38:47 25937 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2018-04-12 01:38:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-12 01:38:47 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-04-12 01:38:47 0 [Note] /usr/sbin/mysqld (mysqld 5.6.39) starting as process 25959 ...
2018-04-12 01:38:47 25959 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-04-12 01:38:47 25959 [Note] InnoDB: The InnoDB memory heap is disabled
2018-04-12 01:38:47 25959 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-12 01:38:47 25959 [Note] InnoDB: Memory barrier is not used
2018-04-12 01:38:47 25959 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-04-12 01:38:47 25959 [Note] InnoDB: Using Linux native AIO
2018-04-12 01:38:47 25959 [Note] InnoDB: Using CPU crc32 instructions
2018-04-12 01:38:47 25959 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-04-12 01:38:47 25959 [Note] InnoDB: Completed initialization of buffer pool
2018-04-12 01:38:47 25959 [Note] InnoDB: Highest supported file format is Barracuda.
2018-04-12 01:38:47 25959 [Note] InnoDB: 128 rollback segment(s) are active.
2018-04-12 01:38:47 25959 [Note] InnoDB: Waiting for purge to start
2018-04-12 01:38:47 25959 [Note] InnoDB: 5.6.39 started; log sequence number 1625977
2018-04-12 01:38:47 25959 [Note] Binlog end
2018-04-12 01:38:47 25959 [Note] InnoDB: FTS optimize thread exiting.
2018-04-12 01:38:47 25959 [Note] InnoDB: Starting shutdown...
2018-04-12 01:38:49 25959 [Note] InnoDB: Shutdown completed; log sequence number 1625987




PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/bin/mysqladmin -u root password 'new-password'
  /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

Note: new default config file not created.
Please make sure your config file is current

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

                                                           [确定]
正在启动 mysqld:                                          [确定]

8.由于mysql刚刚安装完的时候,mysql的root用户的密码默认是空的,所以我们需要及时用mysql的root用户登录(第一次回车键,不用输入密码),并修改密码

# mysql -u root # use mysql; # update user set password=PASSWORD("这里输入root用户密码") where User='root'; # flush privileges;

[root@localhost ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 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
mysql> update user set password=PASSWORD("root") where User='root'
    -> ;
Query OK, 4 rows affected (0.27 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.27 sec)

9.查看mysql是否自启动,并且设置开启自启动命令

# chkconfig --list | grep mysqld # chkconfig mysqld on

10.mysql安全设置(系统会一路问你几个问题,看不懂复制之后翻译,基本上一路yes):

# mysql_secure_installation

[root@localhost ~]# mysql_secure_installation



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.

Enter current password for root (enter for none): 

注意:对于所有MySQL,建议运行这个脚本的所有部分
       服务器在生产中使用! 请仔细阅读每一步!

为了登录到MySQL来保护它,我们需要最新的
root用户的密码。 如果你刚刚安装了MySQL,并且
你还没有设置root密码,密码将是空白的,
所以你应该在这里按回车。

输入root的当前密码(不输入):                   我更改了mysql密码为root,在这我输入root

 

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.

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'.

Change the root password? [Y/n] 

 

注意:对于所有MySQL,建议运行这个脚本的所有部分
       服务器在生产中使用! 请仔细阅读每一步!

为了登录到MySQL来保护它,我们需要最新的
root用户的密码。 如果你刚刚安装了MySQL,并且
你还没有设置root密码,密码将是空白的,
所以你应该在这里按回车。

输入root的当前密码(不输入):
好的,成功使用密码,继续...

设置root密码确保没有人能够登录到MySQL
没有适当授权的root用户。

您已经设置了root密码,因此您可以安全地回答'n'。

更改根密码?[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] 

 

...跳过。

默认情况下,MySQL安装有一个匿名用户,允许任何人
登录到MySQL而不必创建用户帐户
他们。 这仅用于测试并进行安装
走得更顺畅。 你应该在移动到一个之前删除它们
生产环境。

删除匿名用户?[Y/ N]               选择Y,删除匿名用户    

注:其实直接输入mysql是使用了匿名登录数据库

 

 ... 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] 

 

...成功!

通常情况下,root只能被允许从'localhost'连接。 这个
确保有人不能从网络猜测根密码。

禁止远程root登录?[Y/ N]             选择N,我们允许远程登录

 

 ... skipping.

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] 

 

...跳过。

默认情况下,MySQL附带一个名为'测试'的数据库,任何人都可以
访问。 这也仅用于测试,应该删除
在进入生产环境之前。

删除测试数据库并访问它?[Y/ N]            选择y

 

 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - 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] 

 

- 删除测试数据库...
错误1008(HY000)在第1行:无法删除数据库'测试'; 数据库不存在
  ...失败! 不重要,继续前进......
  - 删除测试数据库的权限...
  ...成功!

重新加载特权表将确保到目前为止所做的所有更改
将立即生效。

现在重新加载特权表?[Y/ N]                选择y

 

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

 

全做完了! 如果你已经完成了上述所有步骤,那么你的MySQL
安装现在应该是安全的。

感谢您使用MySQL!


打扫干净...

 

posted @ 2018-04-13 16:35  软刺sec  阅读(514)  评论(0编辑  收藏  举报