centos6.2 安装Mysql5.6

1. mysql官网下载rpm包

[root@slave2 home]# ls

hbase  hive  mysql  mysql57-community-release-el6-11.noarch.rpm  zookeeper

2.安装

[root@slave2 home]# yum install mysql-server -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirrors.neusoft.edu.cn
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 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.x86_64
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: mysql-server-5.1.73                                                            -8.el6_8.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: mysql-server-5.1.73-8                                                            .el6_8.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.1.73-8.el6_8 will be installed
---> Package mysql-libs.x86_64 0:5.1.73-8.el6_8 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================
 Package                      Arch                 Version                         Repository          Size
============================================================================================================
Installing:
 mysql-server                 x86_64               5.1.73-8.el6_8                  base               8.6 M
Installing for dependencies:
 mysql                        x86_64               5.1.73-8.el6_8                  base               895 k
 mysql-libs                   x86_64               5.1.73-8.el6_8                  base               1.2 M
 perl-DBD-MySQL               x86_64               4.013-3.el6                     base               134 k
 perl-DBI                     x86_64               1.609-4.el6                     base               705 k
Transaction Summary
============================================================================================================
Install       5 Package(s)
Total download size: 12 M
Installed size: 33 M
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 12 M
(1/5): mysql-5.1.73-8.el6_8.x86_64.rpm                                               | 895 kB     00:01
(2/5): mysql-libs-5.1.73-8.el6_8.x86_64.rpm                                          | 1.2 MB     00:01
(3/5): mysql-server-5.1.73-8.el6_8.x86_64.rpm                                        | 8.6 MB     00:07
(4/5): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm                                         | 134 kB     00:00
(5/5): perl-DBI-1.609-4.el6.x86_64.rpm                                               | 705 kB     00:01
------------------------------------------------------------------------------------------------------------
Total                                                                       889 kB/s |  12 MB     00:13
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-libs-5.1.73-8.el6_8.x86_64                                                         1/5
  Installing : perl-DBI-1.609-4.el6.x86_64                                                              2/5
  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                                                        3/5
  Installing : mysql-5.1.73-8.el6_8.x86_64                                                              4/5
  Installing : mysql-server-5.1.73-8.el6_8.x86_64                                                       5/5
Installed:
  mysql-server.x86_64 0:5.1.73-8.el6_8
Dependency Installed:
  mysql.x86_64 0:5.1.73-8.el6_8   mysql-libs.x86_64 0:5.1.73-8.el6_8   perl-DBD-MySQL.x86_64 0:4.013-3.el6
  perl-DBI.x86_64 0:1.609-4.el6
Complete!

3. 修改tmp文件权限

[root@slave2 home]# chmod 777 /tmp/

4.启动mysql Service

[root@slave2 home]# service mysqld start
Starting mysqld:                                           [  OK  ]

5.初始化mysql

[root@slave2 home]# 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):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
此错误通过(https://jingyan.baidu.com/article/636f38bb21d883d6b946106f.html)方法解决:

停掉MySQL服务:

/etc/init.d/mysqld stop

使用safe模式,进行重启:

   mysqld_safe --skip-grant-tables

使用root账户,无密码登录:

  mysql -u root

选择mysql database:

  use mysql;

为root用户更改密码为: 123(自行设定):

  update user set password=PASSWORD("123") where User = 'root';

上一篇:jquery制作一个简单的轮播


下一篇:JavaScript笔记之第四天