Linux安装mySql详解

前置:
(1)防火墙关闭
    service iptables stop 
    chkconfig iptables off:开机不启动防火墙
(2)关闭selinux

安装Mysql

(1)检查Linux是否自带的有mysql安装包 

           rpm -qa | grep mysql

(2)卸载linux自带mysql包
        rpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64

(3)通过yum安装mysql
        yum install -y mysql-server
        成功的话,可以看到“Complete!”
        默认安装的是5.1.73

(4)启动mysql服务
        service mysqld start
        如果是5.1的版本,mysql的服务名称:mysqld
        版本>5.5 ,mysql的服务名称:mysql

(5)设置root用户密码,
            /usr/bin/mysqladmin -u root password '123'

 (6)  验证:
                mysql -u root -p
                    show databases
                    use mysql
                    show tables

(7)让mysql服务,随着系统的启动而启动
        查看:
            chkconfig mysqld --list 


        修改:
            chkconfig mysqld  on


        查看:
            chkconfig mysqld --list 

(8)在mysql配置对应的权限

        a:授权
            grant all privileges on *.* to 'root'@'%' identified by '123' with grant option

     b:mysql新建连接

  c:查询 
            select host,user,password from user;

经验告诉你,只保留一条:

d:刷新权限(必须执行)
            flush privileges

(9)重启mysql服务
        service mysqld restart

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值