suse安装rpm打包方式的MySQL

来源:互联网 发布:sql server恢复数据库 编辑:程序博客网 时间:2024/06/05 05:38

1.根据linux发行版到下面的网址下载相应的mysql捆装包(我的当前系统为sles11sp3-x86_64,所以下载的包如下(版本我下的是5.6的)


http://mirrors.sohu.com/mysql/MySQL-5.6/MySQL-5.6.22-1.sles11.x86_64.rpm-bundle.tar

 

2.在安装之前首先删除系统内原有的mysql包,并确认/etc没有my.cnf文件


linux-ig30:~/mysql # rpm -qa |grep mysql |xargs rpm -e --nodeps

linux-ig30:~ # ls -l /etc/my.cnf

ls: cannot access /etc/my.cnf: No such file or directory


3.解压并安装

解压

linux-ig30:~ # mkdir mysql

linux-ig30:~ # tar xvf MySQL-5.6.22-1.sles11.x86_64.rpm-bundle.tar -C mysql/

linux-ig30:~ # cd mysql/

linux-ig30:~/mysql # ls

MySQL-client-5.6.22-1.sles11.x86_64.rpm

MySQL-devel-5.6.22-1.sles11.x86_64.rpm

MySQL-embedded-5.6.22-1.sles11.x86_64.rpm

MySQL-server-5.6.22-1.sles11.x86_64.rpm

MySQL-shared-5.6.22-1.sles11.x86_64.rpm

MySQL-shared-compat-5.6.22-1.sles11.x86_64.rpm

MySQL-test-5.6.22-1.sles11.x86_64.rpm

安装

linux-ig30:~/mysql # rpm -ivh *.rpm   //会自动创建mysql用户和组


注:如果存在包依赖关系,那么就要先建好本地源,然后再通过zypper install *.rpm来安装

 

过程省略,有用的信息如下


ARANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

 

②New defaultconfig file was created as /usr/my.cnf and

will be used bydefault by the server when you start it.

You may edit thisfile to change server settings

 

3.配置mysql

my.cnf的位置

可知my.cnf默认/usr目录下,习惯问题,把my.cnf移动到/etc目录下

linux-ig30:~ # mv /usr/my.cnf /etc/

默认安装完成后,mysql没有启动,首先启动mysql

linux-ig30:~ # /etc/init.d/mysql start

◆默认安装完成后,为mysql设置了一个随机密码,放在了/root/.mysql_secret文件下,由上面的可知

更改mysql root密码(必须更改,不更改不能使用)

linux-ig30:~ # cat .mysql_secret

# The random password set for the root userat Thu Jan  8 21:01:30 2015 (local time):fasTzELW54qTKgBz


linux-ig30:~ # mysqladmin -uroot -pfasTzELW54qTKgBz password

Warning: Using a password on the commandline interface can be insecure.

New password:                         //输入新密码

Confirm new password:                 //再次确认新密码


至此安装完毕


0 0
原创粉丝点击