mysql 5.6的rpm包安装方式记录

推荐 yum安装其它版本mysql的方式更省时
yum安装mysql


以下方式任然可用,只是没意义了

#postfix对rpm安装的影响
yum remove postfix
#卸载旧的mysql
# rpm -qa | grep -i mysql
mysql-libs-5.1.73-8.el6_8.x86_64
rpm -e mysql-libs-5.1.73-8.el6_8.x86_64
#下载 #已下载一份到blog
#wget http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/MySQL-5.6.45-1.el6.x86_64.rpm-bundle.tar
wget http://www.isres.com/file/MySQL-5.6.45-1.el6.x86_64.rpm-bundle.tar
#依赖安装

yum -y install perl autoconf numactl libaio initscripts net-tools

#tar -xvf MySQL-5.6.45-1.el6.x86_64.rpm-bundle.tar
MySQL-devel-5.6.45-1.el6.x86_64.rpm
MySQL-shared-5.6.45-1.el6.x86_64.rpm
MySQL-embedded-5.6.45-1.el6.x86_64.rpm
MySQL-client-5.6.45-1.el6.x86_64.rpm
MySQL-server-5.6.45-1.el6.x86_64.rpm
MySQL-test-5.6.45-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.45-1.el6.x86_64.rpm

rpm -ivh MySQL-server-5.6.45-1.el6.x86_64.rpm

#centos7装不上,运行rpm -ivh MySQL-server-5.6.45-1.el6.x86_64.rpm  --force --nodeps
rpm -ivh MySQL-client-5.6.45-1.el6.x86_64.rpm
rpm -ivh MySQL-devel-5.6.45-1.el6.x86_64.rpm
#centos7装不上,运行 rpm -ivh MySQL-devel-5.6.45-1.el6.x86_64.rpm  --force --nodeps

#安装完成后启动配置 是mysql非mysqld
service mysql start
ps -ef | grep mysql
root     25765     1  0 08:05 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.pid
mysql    25861 25765  1 08:05 pts/0    00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=localhost.err --pid-file=/var/lib/mysql/localhost.pid
root     25942 24919  0 08:06 pts/0    00:00:00 grep mysq

#创建一个配置文件,配置数据库目录到别处以及其它 
mkdir -p /home/mysql_data
chown mysql:mysql /home/mysql_data
cp -r /var/lib/mysql/* /home/mysql_data/
chown -R mysql:mysql /home/mysql_data/

#编辑或创建 /etc/my.cnf
[mysqld]
datadir = /home/mysql_data

[root@localhost mysql_data]# service mysql start
Starting MySQL.. SUCCESS! 
[root@localhost mysql_data]# service mysql stop
Shutting down MySQL.. SUCCESS! 
[root@localhost mysql_data]# service mysqld restart
mysqld: unrecognized service
[root@localhost mysql_data]# service mysql restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL. SUCCESS! 
[root@localhost mysql_data]

如果修改dir后启动失败,参考 https://www.isres.com/database/282.html

接着就是mysql -u root -p 回车后登录配置mysql的root密码了
初次安装临时密码在安装过期中会有提示

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

如果已有密码又忘记了就 参考 https://www.isres.com/mysql/272.html


标签: none

非特殊说明,本博所有文章均为博主原创。

最新文章

发表评论