码迷,mamicode.com
首页 > 数据库 > 详细

centos6.5 使用 rpm 安装 mysql

时间:2017-11-19 11:15:14      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:命令   pass   /etc/   move   efault   date   word   local   安装   

从mysql网站下载mysql rpm安装包(包括server、client)

1、安装server

rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm

强制安装

rpm -ivh --force MySQL-server-5.5.17-1.linux2.6.x86_64.rpm

报如下错误

[root@iZ257d4pjcoZ ~]# rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm --nodepsPreparing...                          ################################# [100%]     
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.19-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.40-1.el7_0.x86_64

原因是与之前lib库冲突,解决方式删除老版本lib库(注意根据你的提示更改相应版本)

yum -y remove mariadb-libs-1:5.5.40-1.el7_0.x86_64* 
yum -y remove mysql-libs-*

再次执行 rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm 即可安装成功

报如下错误

[root@test0001 tools]# rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm 
error: Failed dependencies:
/usr/bin/perl is needed by MySQL-server-5.6.19-1.el6.x86_64
libaio.so.1()(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64

需要安装 libaio

报如下错误,错少perl安装perl

error: Failed dependencies: 
 /usr/bin/perl is needed by MySQL-server-5.6.19-1.el6.x86_64

安装perl

yum install perl

2、启动mysql
启动

service mysql start 

停止

service mysql stop 

重启

service mysql restart 

查看当前mysql状态

service mysql status

3、安装client

rpm -ivh MySQL-client-5.6.19-1.el6.x86_64.rpm

4、客户端登陆 

mysql -uroot -p

5、mysql初始化

[root@xcldtc5m mysql]# /usr/bin/mysql_install_db
[root@xcldtc5m mysql]# service mysql start
[root@xcldtc5m mysql]# cat /root/.mysql_secret
# The random password set for the root user at Sat Feb 7 10:54:24 2015 (local time): VoKvw3vpo_3LiA3c
[root@xcldtc5m mysql]# mysql -uroot -pVoKvw3vpo_3LiA3c
mysql> SET PASSWORD = PASSWORD(‘2345678‘);
mysql> exit
[root@xcldtc5m mysql]# mysql -uroot -p2345678

6、远程登录配置

mysql> use mysql
mysql> select host ,user ,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *BC1C4715C23459AB982AD2D6617B4F8790161763 |
| xcldtc5m | root | *44CF61DA6CDeeee2085F4598F728CF221DA8F167 |
| 127.0.0.1 | root | *44CF61DA6CD83e32085F4598F728CF221DA8F167 |
| ::1 | root | *44CF61DA6CD86832345F4598F728CF221DA8F167 |
+-----------+------+-------------------------------------------+
mysql> update user set password=password(‘234567‘) where user=‘root‘;
mysql> update user set host=‘%‘ where host=‘localhost‘;

重新启动mysql或是刷新

7、设置开机自启动

[root@xcldtc5m mysql]# chkconfig mysql on
[root@xcldtc5m mysql]# chkconfig --list | grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

8、查看mysql配置文件位

[root@xcldtc5m mysql]# mysqld --verbose --help | grep -A 1 ‘Default options‘

9、MYSQL默认安装位置

/var/lib/mysql/ #数据库目录 /usr/share/mysql #配置文件目录
/usr/bin #相关命令目录 /etc/init.d/mysql #启动脚本

10、更改mysql默认引擎为Innodb

在配置文件my.ini中的 [mysqld] 下面加入default-storage-engine=INNODB
之后重启即可

  

  

  

  

centos6.5 使用 rpm 安装 mysql

标签:命令   pass   /etc/   move   efault   date   word   local   安装   

原文地址:http://www.cnblogs.com/rslai/p/7858985.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!