redhat6.3 安装mysql_redhat6.3安装MySQL-server-5.6.13-1.el6.x86_64.rpm | 学步园

本文详细介绍了在Linux环境下安装MySQL 5.6的步骤,包括下载RPM包,使用root权限安装server、devel、client,初始化数据库,启动和检查MySQL服务,设置root密码,以及允许远程访问的配置。通过这些步骤,读者可以成功地部署并管理MySQL服务器。
摘要由CSDN通过智能技术生成

首先下载下面三个文件:

MySQL-client-5.6.13-1.el6.x86_64.rpm

MySQL-devel-5.6.13-1.el6.x86_64.rpm

MySQL-server-5.6.13-1.el6.x86_64.rpm

然后使用root账号登陆,进行安装:

1. 安装server、devel、client:1. 安装server、devel、client:

rpm -ivh --replacefiles MySQL-s*.rpm

rpm -ivh --replacefiles MySQL-d*.rpm

rpm -ivh --replacefiles MySQL-c*.rpm

[root@localhostdownload]# rpm -ivh --replacefiles MySQL-server-5.6.13-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-server           ########################################### [100%]

[root@localhostdownload]# rpm -ivh --replacefiles MySQL-client-5.6.13-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-client           ########################################### [100%]

[root@localhostdownload]# rpm -ivh --replacefiles MySQL-devel-5.6.13-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-devel            ########################################### [100%]

要移除安装可以使用 rpm -e MySQL-server  、 rpm -e MySQL-devel、MySQL-client即可;

2. 初始化数据库:

/usr/bin/mysql_install_db

3. 启动mysql服务:

service mysql start

使用命令ps -ef | grep mysql 查看mysql进程:

[root@localhost~]# ps -ef | grep mysql

root     260471018:14pts/1200:00:00/bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid

mysql    2622726047018:14pts/1200:00:01/usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysql/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock

root     2654524726018:27pts/800:00:00grep mysql

4.第一次登陆设置root密码:

首先查看 cat /root/.mysql_secret

root@localhost~]# cat /root/.mysql_secret

# The random password set forthe root user at Fri Aug3015:57:182013(local time): fMYcarvB

然后命令行:mysql -u root -p ,然后输入上面的密码即可:

[root@localhost~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.6.13MySQL Community Server (GPL)

Copyright (c) 2000,2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;'or'\h'forhelp. Type'\c'to clear the current input statement.

设置root密码:

mysql> use mysql

Database changed

mysql> update user set password=password('root') where user='root';

Query OK, 0rows affected (0.15sec)

Rows matched: 5Changed:0Warnings:0

mysql> flush privileges;

Query OK, 0rows affected (0.00sec)

退出,重新登陆即可使用新的密码登陆;

5. 设置远程登陆:

使用root登陆到mysql后

mysql> update user set host='%'where user='root';

ERROR 1062(23000): Duplicate entry'%-root'forkey'PRIMARY'

mysql> select host,user from user;

+-----------------------+------+

| host                  | user |

+-----------------------+------+

| %                     | root |

| 127.0.0.1| root |

| 192.168.128.142| root |

| ::1| root |

| localhost.localdomain | root |

+-----------------------+------+

5rows in set (0.00sec)

然后:

mysql> grant all privileges on *.* to'root'@'%'with grant option;

Query OK, 0rows affected (0.08sec)

mysql> exit

Bye

[root@localhost~]# service mysql restart

Shutting down MySQL.. SUCCESS!

Starting MySQL.. SUCCESS!

重启mysql即可远程登陆。

分享,快乐,成长

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值