centos6.5 yum安装MySQL5.6
2016-05-11 10:01
661 查看
创建MySQL用户
安装仓库
要使用yum 安装mysql,要使用mysql的yum仓库,先从官网下载适合你系统的仓库 http://dev.mysql.com/downloads/repo/yum/ 然后安装一下这个仓库列表
wget http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm rpm -ivh mysql-community-release-el6-5.noarch.rpm
#useradd mysql #passwd mysql #chmod u+w /etc/sudoers #vi /etc/sudoers mysql ALL=(ALL) ALL
安装仓库
要使用yum 安装mysql,要使用mysql的yum仓库,先从官网下载适合你系统的仓库 http://dev.mysql.com/downloads/repo/yum/ 然后安装一下这个仓库列表
wget http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm rpm -ivh mysql-community-release-el6-5.noarch.rpm
或: # yum install http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm[/code]
选择版本
查看可安装的mysql版本[mysql@mysql-1 ~]$ yum repolist enabled | grep "mysql.*-community.*" mysql-connectors-community MySQL Connectors Community 21 mysql-tools-community MySQL Tools Community 35 mysql57-community MySQL 5.7 Community Server 82
如果我们要选择版本,可以先执行下面这个命令查看一下有哪些版本[mysql@mysql-1 ~]$ yum repolist all | grep mysql
选择版本,启用5.6版本的,禁用5.7版本子仓库[mysql@mysql-1 ~]$ sudo yum-config-manager --enable mysql56-community [mysql@mysql-1 ~]$ sudo yum-config-manager --disable mysql57-community
或者
编辑/etc/yum.repos.d/mysql-community.repo文件
enabled=0 表示禁用
比如要安装5.7版本的mysql,要确定5.6的enabled=0,5.7的enabled=1,一次保证只启用一个子仓库
查看可安装的mysql版本[mysql@mysql-1 ~]$ yum repolist enabled | grep "mysql.*-community.*" mysql-connectors-community MySQL Connectors Community 21 mysql-tools-community MySQL Tools Community 35 mysql56-community MySQL 5.6 Community Server 248
安装[mysql@mysql-1 ~]$ sudo yum install mysql-community-server
启动数据库[root@mysql-1 mysql]# /usr/bin/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): ----输入root密码(默认为空): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] y ----是否要修改root密码: New password: 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 ... 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 ... 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] n ... skipping. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] 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... [root@mysql-1 mysql]#
View Code[root@mysql-1 mysql]# service mysqld status mysqld (pid 3097) 正在运行...
相关文章推荐
- mac平台下LuaJIT-2.1.0-beta2 编译android i686-linux-android-clang: Command not found
- linux命令
- linux ps命令学习
- Red Hat Enterprise Linux 6 系统安装
- Red Hat Enterprise Linux 7 系统安装
- APUE,TLPI读书笔记——linux IO相关
- linux简单入门
- Linux下C/C++版本发布自动脚本
- Linux makefile 教程 非常详细,且易懂
- Linux下重命名文件或文件夹(mv命令与rename命令)
- iptables删除指定某条规则
- linux查看CPU性能及工作状态的指令
- centos6.5下升级python版本为python2.7
- Linux常用命令(五)用户及用户组管理
- <linux kernel>plz do not use usleep(0)!
- 2016年Linux学习决心书(老男孩教育在线课程班第二期)
- Linux自启动执行命令
- 初始化0号进程
- 我的决心书
- 使用VS Code 开发.NET Core 应用程序 部署到Linux 跨平台