CentOS6.5 安装mysql 5.5

CentOS 6.5通过yum安装 MySQL-5.5

1.安装mysql-5.5的yum源

rpm -ivh http://repo.mysql.com/yum/mysql-5.5-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
要安装MySQL5.6的可以安装:

rpm -ivh http://repo.mysql.com/mysql-community-release-el6.rpm
最新的yum源可以去http://dev.mysql.com/downloads/repo/yum下载

2.修改安装好的yum源

编辑 /etc/yum.repos.d/mysql-community.repo文件,将5.5的enabled改为1,5.6的enabled改为0

#Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

#Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

3.安装mysql-5.5

yum install mysql-community-client mysql-community-devel mysql-community-server php-mysql

接下来**************************************************

第1步、yum安装mysql

[root@stonex ~]# yum -y install mysql-server

第2步、设置开机启动

[root@stonex ~]# chkconfig mysqld on
第3步、启动MySql服务

[root@stonex ~]# service mysqld start
第4步、设置MySQL的root用户设置密码

[root@stonex ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
… 省略了一些行
mysql> select user,host,password from mysql.user;
查询用户的密码,都为空,用下面的命令设置root的密码为root

mysql> set password for root@localhost=password(‘root’);
mysql> exit
第5步、用新密码登陆

[root@stonex ~]# mysql -u root -p
第6步、基本命令(进入mysql>执行)

show databases; //查看系统已存在的数据库
use databasesname; //选择需要使用的数据库
drop database databasename; //删除选定的数据库
exit //退出数据库的连接
create database test01; //建立名为test的数据库
show tables; // 列出当前数据库下的表

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值