centOS 6.5 下安装MySQL 5.6.21
2016-10-24 17:40
267 查看
1.查看操作系统相关信息。
需要下载三个rpm软件包:
MySQL-client-5.6.21-1.rhel5.x86_64.rpm
MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
MySQL-server-5.6.21-1.rhel5.x86_64.rpm
[root@linuxidc ~]# cat /etc/issue CentOS release 6.5 (Final) Kernel \r on an \m [root@linuxidc ~]# uname -a Linux linuxidc 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux2.创建需要下载rpm软件包的目录。
[root@linuxidc ~]# mkdir -p /taokey/tools查看下是否有系统自带MySQL的rpm包,如果有,需要删除自带的旧rpm包。
[root@linuxidc ~]# rpm -qa | grep mysql-libs-5.1.71-1.el6.x86_64 [root@linuxidc ~]# yum -y remove mysql-libs-5.1* [root@linuxidc ~]# rpm -qa | grep mysql4.在MySQL官网下载安装MySQL-5.6.21所需的rpm软件包。
需要下载三个rpm软件包:
MySQL-client-5.6.21-1.rhel5.x86_64.rpm
MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
MySQL-server-5.6.21-1.rhel5.x86_64.rpm
[root@linuxidc ~]# cd /taokey/tools/ [root@linuxidc tools]#wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm[/code]5.下载完之后,安装三个rpm软件包。
5.1如果提示需要安装perl:[root@linuxidc tools]#yum install perl5.2安装下载的软件包:[root@linuxidc tools]# rpm -ivh MySQL-client-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc tools]# rpm -ivh MySQL-devel-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc tools]# rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-server ########################################### [100%] ……………… ……………… A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! You will find that password in '/root/.mysql_secret'. You must change that password on your first conne 4000 ct, no other statement but 'SET PASSWORD' will be accepted. See the manual for the semantics of the 'password expired' flag. Also, the account for the anonymous user has been removed. In addition, you can run: /usr/bin/mysql_secure_installation在安装MySQL-server,见上面的一段话,
大意是全新安装设置的root密码在/root/.mysql_secret中,这是一个随机密码,你需要运行/usr/bin/mysql_secure_installation,删除anonymous用户。当然不建议用root用户来运行,rpm包已经建了一个mysql用户,可以使用这个用户:
[root@linuxidc tools]#more /root/.mysql_secret # The random password set for the root user at Tue Nov 18 22:57:46 2014 (local t ime): NljqL63OYlGo5cqy <– 得到root访问mysql的密码:NljqL63OYlGo5cqy # service mysql start Starting MySQL... SUCCESS! [root@linuxidc tools]# /usr/bin/mysql_secure_installation --user=mysql 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): <–使用刚才得到的root的密码 NljqL63OYlGo5cqy 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] y <– 是否更换root用户密码,输入y并回车,强烈建议更换 New password: <– 设置root用户的密码 Re-enter new password: <– 再输入一次你设置的密码 Password updated successfully! Reloading privilege tables.. ... Success! 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 <– 是否删除匿名用户,生产环境建议删除,所以输入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. Disallow root login remotely? [Y/n] y <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 ... 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. Remove test database and access to it? [Y/n] y <– 是否删除test数据库,输入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 是否重新加载权限表,输入y并回车 ... Success! 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加到开机服务里:[root@linuxidc tools]# chkconfig auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off iscsi 0:off 1:off 2:off 3:on 4:on 5:on 6:off iscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off multipathd 0:off 1:off 2:off 3:off 4:off 5:off 6:off mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off <-看到这个OK了 netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:offMySQL安装后涉及的目录如下:
目录 目录中的内容/usr/bin 客户端程序和脚本 /usr/sbin Mysqld服务器 /var/lib/mysql 数据库的日志文件 /usr/share/info 信息格式手册 /usr/share/man Unix 手册页 /usr/include/mysql 包括 (标题) 的文件 /usr/lib/mysql mysql的lib包 /usr/share/mysql 杂项的支持文件,包括错误消息) 字符设置的文件,示例配置文件,SQL 数据库安装 /usr/share/sql-bench 基准现在好了,可以测试你的MySQL了。
相关文章推荐
- Centos 6.5 下安装mysql 5.6.21的方法
- 在最小化安装的centos6.5中编译安装最新mysql-5.6.21并做基本优化
- Centos 6.5 下安装mysql 5.6.21的方法
- 阿里云512M主机(CentOS 6.5)编译安装MySQL 5.6.21遇到的问题
- centos6.5 rpm安装mysql5.6.19
- centos 6.5 32位 编译安装Mysql
- 在CentOS6.5中安装MySQL及遇到的问题Can't open the mysql.plugin table.
- CentOS 6.5 系统 LAMP(Apache+MySQL+PHP)安装步骤
- Centos6.5使用yum安装mysql——快速上手必备
- CentOS6.5_Nginx1.40_Php5.57_MySQL5.5.35编译安装全记录
- centos6.5源码编译安装mysql5.6.17
- [转] CentOS6.5安装配置Apache和PHP、MySQL
- [Linux]在CentOS 6.5上安装MySQL
- Centos6.5安装MySQL5.6
- CentOS 6.5 yum安装配置lnmp服务器(Nginx+PHP+MySQL)+快速代理转发
- CentOS6.5安装MySql、Apache、PHP
- CentOS 6.5 yum安装配置lnmp服务器(Nginx+PHP+MySQL)
- rpm安装MySQL5.5后配置,在centos5上;mysql编译安装在centos6.5上;
- centos6.5安装配置nginx+php+mysql+httpsqs+ttserver+redis
- CentOS 6.5 MySQL安装