centos的6.9版本安装mysql

  用yum安装后,执行service命令启动:

[root@centos ~]# yum install mysql-server
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i686 0:5.1.73-8.el6_8 will be installed
--> Processing Dependency: mysql = 5.1.73-8.el6_8 for package: mysql-server-5.1.73-8.el6_8.i686
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-8.el6_8.i686
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16) for package: mysql-server-5.1.73-8.el6_8.i686
--> Processing Dependency: libmysqlclient_r.so.16 for package: mysql-server-5.1.73-8.el6_8.i686
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16) for package: mysql-server-5.1.73-8.el6_8.i686
--> Processing Dependency: libmysqlclient.so.16 for package: mysql-server-5.1.73-8.el6_8.i686
--> Running transaction check
---> Package mysql.i686 0:5.1.73-8.el6_8 will be installed
---> Package mysql-libs.i686 0:5.1.73-8.el6_8 will be installed
---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================
 Package                                      Arch                               Version                                        Repository                        Size
=======================================================================================================================================================================
Installing:
 mysql-server                                 i686                               5.1.73-8.el6_8                                 os                               8.8 M
Installing for dependencies:
 mysql                                        i686                               5.1.73-8.el6_8                                 os                               904 k
 mysql-libs                                   i686                               5.1.73-8.el6_8                                 os                               1.2 M
 perl-DBD-MySQL                               i686                               4.013-3.el6                                    os                               134 k

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

Total download size: 11 M
Installed size: 31 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): mysql-5.1.73-8.el6_8.i686.rpm                                                                                                            | 904 kB     00:01     
(2/4): mysql-libs-5.1.73-8.el6_8.i686.rpm                                                                                                       | 1.2 MB     00:01     
(3/4): mysql-server-5.1.73-8.el6_8.i686.rpm                                                                                                     | 8.8 MB     00:12     
(4/4): perl-DBD-MySQL-4.013-3.el6.i686.rpm                                                                                                      | 134 kB     00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                  667 kB/s |  11 MB     00:16     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-libs-5.1.73-8.el6_8.i686                                                                                                                      1/4 
  Installing : perl-DBD-MySQL-4.013-3.el6.i686                                                                                                                     2/4 
  Installing : mysql-5.1.73-8.el6_8.i686                                                                                                                           3/4 
  Installing : mysql-server-5.1.73-8.el6_8.i686                                                                                                                    4/4 
  Verifying  : mysql-server-5.1.73-8.el6_8.i686                                                                                                                    1/4 
  Verifying  : mysql-libs-5.1.73-8.el6_8.i686                                                                                                                      2/4 
  Verifying  : perl-DBD-MySQL-4.013-3.el6.i686                                                                                                                     3/4 
  Verifying  : mysql-5.1.73-8.el6_8.i686                                                                                                                           4/4 

Installed:
  mysql-server.i686 0:5.1.73-8.el6_8                                                                                                                                   

Dependency Installed:
  mysql.i686 0:5.1.73-8.el6_8                        mysql-libs.i686 0:5.1.73-8.el6_8                        perl-DBD-MySQL.i686 0:4.013-3.el6                       

Complete!
[root@centos ~]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

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

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[  OK  ]
Starting mysqld:  [  OK  ]

  我们看到6.9的centos安装的mysql是5.1.73版本的,虽然比较老,毕竟还能用。

  接着设置root用户密码:

[root@centos ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, 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> 
mysql> 
mysql> 
mysql> 
mysql> select user,password,host from mysql.user;
+------+----------+-------------------+
| user | password | host              |
+------+----------+-------------------+
| root |          | localhost         |
| root |          | centos |
| root |          | 127.0.0.1         |
|      |          | localhost         |
|      |          | centos |
+------+----------+-------------------+
5 rows in set (0.00 sec)

mysql> set password for root@localhost=password('123456');
Query OK, 0 rows affected (0.00 sec)

mysql> select user,password,host from mysql.user;
+------+-------------------------------------------+-------------------+
| user | password                                  | host              |
+------+-------------------------------------------+-------------------+
| root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost         |
| root |                                           | centos |
| root |                                           | 127.0.0.1         |
|      |                                           | localhost         |
|      |                                           | centos |
+------+-------------------------------------------+-------------------+
5 rows in set (0.00 sec)

  接着就可以开始玩了。

猜你喜欢

转载自www.cnblogs.com/wuxun1997/p/12082355.html