首页 > 数据库 > MySQL > 正文

CentOS下RPM方式安装MySQL5.6教程

2024-07-24 12:52:02
字体:
来源:转载
供稿:网友

之前的项目全都在windows系统环境下部署的,这次尝试在Linux系统环境下部署,于是这次我们组织在7台主机上安装了JDK、Maven、Jboss其中一台安装了Mysql,并将局域网配置好,终于大功告成了。下面将安装步骤与大家分享!

    系统版本:centos6.3-i386 32位操作系统
    硬件配置:内核 Intel(R) Pentium(R) 4 CPU 3.00GHz 内存998.5M 
    安装环境:使用shell 命令

此次安装在桌面环境下,使用shell命令进行安装,下载安装包为:
MySQL-5.6.25-1.linux_glibc2.5.i386.rpm-bundle.tar;
a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)

[root@localhost ~]# rpm -qa | grep -i mysqlmysql-libs-5.1.66-2.el6_3.x86_64[root@localhost ~]# yum -y remove mysql-libs*

b. 选择Linux对应的RPM包,如下:

[root@localhost rpm]# lltotal 74364-rw-r--r--. 1 root root 18442536 Dec 11 20:19 MySQL-client-5.6.15-1.el6.x86_64.rpm-rw-r--r--. 1 root root 3340660 Dec 11 20:06 MySQL-devel-5.6.15-1.el6.x86_64.rpm-rw-r--r--. 1 root root 54360600 Dec 11 20:03 MySQL-server-5.6.15-1.el6.x86_64.rpm

c. 安装MySQL

[root@localhost rpm]# rpm -ivh MySQL-server-5.6.15-1.el6.x86_64.rpm[root@localhost rpm]# rpm -ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm[root@localhost rpm]# rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm#修改配置文件位置[root@localhost rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

d. 初始化MySQL及设置密码

[root@localhost rpm]# /usr/bin/mysql_install_db[root@localhost rpm]# service mysql start[root@localhost rpm]# cat /root/.mysql_secret #查看root账号密码# The random password set for the root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnl[root@localhost ~]# mysql -uroot –pqKTaFZnlmysql> SET PASSWORD = PASSWORD('123456'); #设置密码为123456mysql> exit[root@localhost ~]# mysql -uroot -p123456

e. 远程登陆用户设置

mysql> use mysql;mysql> select host,user,password from user;+-----------------------+------+-------------------------------------------+| host | user | password |+-----------------------+------+-------------------------------------------+| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 || localhost.localdomain | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 || 127.0.0.1 | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 || ::1 | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 |+-----------------------+------+-------------------------------------------+mysql> update user set password=password('123456') where user='root';mysql> update user set host='%' where user='root' and host='localhost';mysql> flush privileges;mysql> exit
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表