CentOS6.6 下 rpm 安装mysql5.6
来源:互联网 发布:2016淘宝同城交易规则 编辑:程序博客网 时间:2024/05/05 16:54
MySql 数据库安装配置教程
第一部分:安装数据库
step1.解压安装文件
下载mysql http://dev.mysql.com/downloads/mysql/5.6.html#downloads
解压MySQL-5.6.26-1.linux_glibc2.5.x86_64.rpm-bundle.tar。
该文件在/home/mysql目录下
#tar xvf MySQL-5.6.26-1.linux_glibc2.5.x86_64.rpm-bundle.tar
MySQL-server-5.6.26-1.linux_glibc2.5.x86_64.rpm
MySQL-shared-compat-5.6.26-1.linux_glibc2.5.x86_64.rpm
MySQL-client-5.6.26-1.linux_glibc2.5.x86_64.rpm
step2.安装依赖库文件
安装MySQL-shared-compat替换mysql-libs,如果不替换,在删除mysql-libs,会提示postfix依赖于mysql-libs:
# rpm -i MySQL-shared-compat-5.6.26-1.linux_glibc2.5.x86_64.rpm
# rpm -qa | grep -i mysql
mysql-libs-5.1.71-1.el6.i686
MySQL-shared-compat-5.6.26-1.el6.x86_64
卸载就版本库
# rpm -e mysql-libs
step3.测试安装
测试MySQL-server安装,提示需要安装perl:
# rpm -ivh –-testMySQL-server-5.6.26-1.linux_glibc2.5.x86_64.rpm
warning: MySQL-server-5.6.26-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
如果不是上面打印内容,说明存在问题,提示 perl 缺少需要联网安装 perl
# yum install perl
step4.安装MySQL-server,MySQL-client
安装MySQL-server,MySQL-client:
# rpm -ivh MySQL-server-5.6.26-1.linux_glibc2.5.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 connect,
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
………………
………………
# rpm -ivh MySQL-client-5.6.26-1.linux_glibc2.5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
step5.配置root密码等属性
在安装MySQL-server,见上面的一段话,大意是全新安装设置的root密码在/root/.mysql_secret中,这是一个随机密 码,你需要运行/usr/bin/mysql_secure_installation,删除anonymous用户。当然不建议用root用户来运 行,rpm包已经建了一个mysql用户,可以使用这个用户:
#more /root/.mysql_secret
# The random password set for the root user at Tue Nov 18 22:57:46 2014 (local time): NljqL63OYlGo5cqy <– 得到root访问mysql的密码:NljqL63OYlGo5cqy
# service mysql start
Starting MySQL... SUCCESS!
# /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...
step6.设置开机启动
[root@stonex ~]# chkconfig mysql on
step7.创建新用户mysql
[root@stonex ~]# mysql -u root –p
mysql> create user 'mysql'@'localhost' identified by '111';
结果:Query OK, 0 rows affected (0.00 sec)
Step9.给新用户mysql授权
注意:@左边是用户名,右边是域名、IP和%,表示可以访问mysql的域名和IP,%表示外部任何地址都能访问。
授权: 本地登陆所有权限
mysql>grant all privileges on *.* to 'mysql'@'localhost' identified by '111';
授权:非本机访问IP:授权此ip192.168.5.232访问mysql服务器 (此处改为自己电脑的ip)装机时ip为windows 电脑的ip ,生产环境中数据库服务器与web服务器分离情况需要收取web 服务器 地址。
外部连接需要防火墙开放端口3306:
lokkit --port=3306:tcp
若此数据库服务器与web服务器分离需要 授权web 服务器ip地址 ,并开放3306端口
mysql>grant all privileges on *.* to 'mysql'@'192.168.5.232' identified by '111';
Query OK, 0 rows affected (0.00 sec)
刷新权限:
mysql>flush privileges;
Query OK, 0 rows affected (0.00 sec)
- CentOS6.6 下 rpm 安装mysql5.6
- CentOS6.6下使用rpm安装mysql5.6
- CentOS6.5系统下RPM包安装MySQL5.6
- CentOS6.5下RPM方式安装MySQL5.6
- CentOS6.5系统下RPM包安装MySQL5.6
- CentOS6.5系统下RPM包安装MySQL5.6
- CentOS6.5下RPM方式安装MySQL5.6
- 【转载】----CentOS6.5系统下RPM包安装MySQL5.6
- CentOS6.5系统下RPM包安装MySQL5.6
- CentOS6.5系统下RPM包安装MySQL5.6
- CentOS6.5系统下RPM包安装MySQL5.6
- centos6上RPM方式安装MySQL5.6
- centos6使用rpm方式安装mysql5.6
- centos6.5 rpm 安装mysql5.6
- CentOS6.5 RPM方式安装MySQL5.6
- MySQL数据库系列之Centos6.5系统下RPM包安装MySQL5.6
- CentOS6.5系统下RPM包安装MySQL5.6(亲测可行)
- Centos6.4 用rpm方式安装MySql5.6
- Java基础03 构造器与方法重载
- 80 - Remove Duplicates from Sorted Array II
- 面向对象的6的原则
- Ajax.dll的使用方法
- 杭电2000ASCII码排序(非数组方法)
- CentOS6.6 下 rpm 安装mysql5.6
- Android 彻底征服 ListView 一 (实用篇)
- 读《别告诉我你会记笔记》pdf 版
- log4j简单使用
- OAuth 2.0 原理与流程详解
- Appium IOS 自动化测试初探
- 博客? 笔记?
- Autodesk技术动态简报-2016-3-17
- IBM serverx服务器RAID阵列磁盘配置JBOD模式(直通模式)