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
centos6.5环境通过rpm包安装mysql5.5.51数据库
最新推荐文章于 2023-08-01 10:02:52 发布