MySQL安装过程中出现的问题(一)

2014-11-24 10:33:01 · 作者: · 浏览: 0
MySQL安装过程中出现的问题
1>解压缩MySQL
[html] 
[root@localhost test]# tar -xvf MySQL-5.6.12-2.linux_glibc2.5.i386.rpm-bundle.tar   
  
MySQL-test-5.6.12-2.linux_glibc2.5.i386.rpm  
  
MySQL-shared-5.6.12-2.linux_glibc2.5.i386.rpm  
  
MySQL-embedded-5.6.12-2.linux_glibc2.5.i386.rpm  
  
MySQL-client-5.6.12-2.linux_glibc2.5.i386.rpm  
  
MySQL-devel-5.6.12-2.linux_glibc2.5.i386.rpm  
  
MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm  
  
MySQL-shared-compat-5.6.12-2.linux_glibc2.5.i386.rpm  
2>安装MySQL
[html]
(1) 如果已经安装了MySQL,会出现以下提示信息:
[root@localhost test]# rpm -ivh MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm   
  
Preparing...                ########################################### [100%]  
  
package MySQL-server-5.6.12-2.linux_glibc2.5.i386 is already installed  
  
[root@localhost test]# rpm -ivh MySQL-client-5.6.12-2.linux_glibc2.5.i386.rpm   
  
Preparing...                ########################################### [100%]  
  
package MySQL-client-5.6.12-2.linux_glibc2.5.i386 is already installed  

可以先进行卸载MySQL
使用命令rpm –e MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm –nodeps
[html] 
rpm –e MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm --nodeps  

(2)如果没有提示这些信息,那么会正常安装.
[html] 
[root@localhost test]# rpm -ivh MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm  
  
Preparing...                ########################################### [100%]  
  
1:MySQL-server           ########################################### [100%]  
  
[root@localhost test]# rpm -ivh MySQL-client-5.6.12-2.linux_glibc2.5.i386.rpm   
  
Preparing...                ########################################### [100%]  
  
1:MySQL-client           ########################################### [100%]  

3>启动MySQL
(1)首次启动MySQL服务器,出现异常信息的解决办法
[html] 
[root@localhost test]# service mysql start  
  
Starting MySQL.......................... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.pid).  

由于mysql启动的僵死进程,需要将其杀死之后方能启动
[html] 
[root@localhost test]# ps -ef | grep mysql  
  
root      1953     1  0 22:18          00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid  
  
mysql     2171  1953  0 22:18          00:00:04 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid  
  
root      3282     1  0 22:37 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.pid  
  
mysql     3386  3282  2 22:37 pts/0    00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.err --pid-file=/var/lib/mysql/localhost.pid  
  
root      3482  2681  0 22:38 pts/0    00:00:00 grep mysql  

使用kill -9 2171之类杀死
再使用service mysql start或者/etc/init.d/mysql start
[html] 
[root@localhost test]# service mysql start  
  
Starting MySQL SUCCESS!  

4>登录MySQL
[html] 
[root@localhost test]# mysql -u root -p  
  
Enter password:   
  
Welcome to the MySQL monitor.  Commands end with ; or \g.  
  
Your MySQL connection id is 2  
  
Server version: 5.6.12 MySQL Com