centos6.5环境通过rpm包安装mysql5.5.51数据库

centos6.5环境通过rpm包安装mysql5.5.51数据库


注意:此方法适用于单独安装数据库的需求,如果在该机器上还需要安装php环境,建议mysql通过编译或yum方式安装


1.查找已经安装的mysql并删除
rpm -qa | grep mysql
mysql-libs-5.1.73-7.el6.x86_64
mysql-5.1.73-7.el6.x86_64


rpm -e mysql-libs-5.1.73-7.el6.x86_64 --nodeps
rpm -e mysql-5.1.73-7.el6.x86_64 --nodeps


2.rpm安装mysql5.5.51
rpm -ivh MySQL-server-5.5.51-1.el6.x86_64.rpm 
rpm -ivh MySQL-client-5.5.51-1.el6.x86_64.rpm 
rpm -ivh MySQL-devel-5.5.51-1.el6.x86_64.rpm 


安装:
 rpm -ivh MySQL-devel-5.5.51-1.el6.x86_64.rpm 
warning: MySQL-devel-5.5.51-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]


[root@node2 ~]# rpm -ivh MySQL-server-5.5.51-1.el6.x86_64.rpm 
warning: MySQL-server-5.5.51-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
160901  1:42:12 [Note] /usr/sbin/mysqld (mysqld 5.5.51) starting as process 6139 ...
160901  1:42:12 [Note] /usr/sbin/mysqld (mysqld 5.5.51) starting as process 6146 ...


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 node2.chinasoft.com 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.


Please report any problems at http://bugs.mysql.com/


[root@node2 ~]# rpm -ivh MySQL-client-5.5.51-1.el6.x86_64.rpm 
warning: MySQL-client-5.5.51-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]


报错:
error: Failed dependencies:
MySQL-devel conflicts with mysql-devel-5.1.73-7.el6.x86_64
删除原有的mysql5.1
rpm -e mysql-devel-5.1.73-7.el6.x86_64 --nodeps


3.验证是否安装成功
pm -qa|grep -i mysql
MySQL-client-5.5.51-1.el6.x86_64
MySQL-server-5.5.51-1.el6.x86_64
MySQL-devel-5.5.51-1.el6.x86_64


配置文件
cp /usr/share/mysql/my-large.cnf /etc/my.cnf


mkdir /data/mydata
修改配置文件
vim /etc/my.cnf
socket = /data/mydata/mysql.sock
socket = /data/mydata/mysql.sock
datadir=/data/mydata


4.初始化数据库
/usr/bin/mysql_install_db


改变/data/的所有者
chown -R mysql.mysql /data


启动数据库
service mysql start
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值