Centos6在rpm安装
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install mysql-server –y
启动
service mysqld start
初始化
mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n]
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]
启动mysql:
mysql –uroot –p******
下载好的rpm包安装:
tar –zxvf MySQL-5.6.31-1.linux_glibc2.5.x86_64.rpm-bundle.tar –C /opt
cd /opt
rpm –ivh MySQL-devel-5.6.31-1.el6.x86_64.rpm
rpm –ivh MySQL- embedded -5.6.31-1.el6.x86_64.rpm
rpm –ivh MySQL-shared-5.6.31-1.el6.x86_64.rpm
rpm –ivh MySQL-server-5.6.31-1.el6.x86_64.rpm
rpm –ivh MySQL-client-5.6.31-1.el6.x86_64.rpm
rpm –ivh MySQL-test-5.6.31-1.el6.x86_64.rpm
默认安装目录和数据目录
配置文件目录: /etc/my.cnf
服务名mysql : /etc/init.d/mysql
bin目录 : /usr/bin
lib目录 : /usr/lib64/mysql
include目录 : /usr/include/mysql
默认data目录 : /var/lib/mysql
启动:service mysql start
查询密码cat /root/.mysql_secret
进入mysql:mysql –uroot –p******
安装过程中可能遇到的问题:
1. libmysqlclient.so和libmysqlclient_r.so报错
可以安装的时候—skip-broken跳过依赖也可以建立软链接
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
2. Starting MySQL. ERROR!The server quit without updating PID file (/usr/local/mysql/data/localhost.localmain.pid).
这个可以看下具体位置的error文档,里面有显示哪里出的问题,还有一个方式是完全卸载mysql重新安装,要注意删除/etc/my.cnf /usr/lib64/mysql
/usr/lib/mysql关于mysql的都删除
3.安装时候显示已经安装了旧版本,就用rpm –e –nodeps ****卸载就可以了