今天为了搭建bbs服务而搭建lnmp环境,使用yum安装mysql,但需要5.5版本以上。
试了许多方法,都失败了。
一般的yum安装mysql,安装的版本是5.1版本,所以我使用yum其他源安装的我用的是remi源。
首先使用的方法是:
[root@test /]# yum install -y mysql --enablerepo=remi
Loaded plugins: fastestmirror, security Setting up Install Process Loading mirror speeds from cached hostfile * epel: mirrors.ustc.edu.cn * remi: fr2.rpmfind.net Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.5.43-1.el6.remi will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================================================================== Installing: mysql x86_64 5.5.43-1.el6.remi remi 5.8 M Transaction Summary ========================================================================================================================================================================================================== Install 1 Package(s) Total download size: 5.8 M Installed size: 29 M Downloading Packages: mysql-5.5.43-1.el6.remi.x86_64.rpm | 5.8 MB 07:23 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mysql-5.5.43-1.el6.remi.x86_64 1/1 Verifying : mysql-5.5.43-1.el6.remi.x86_64 1/1 Installed: mysql.x86_64 0:5.5.43-1.el6.remi Complete!
大家看,安装是安装成功了那么我接下来要启动mysql服务了:
[root@test /]# service mysql start mysql: unrecognized service [root@test /]# service mysql restart mysql: unrecognized service [root@test /]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
都失败了,那好我去找下mysqld:
[root@test init.d]# ls abrt-ccpp autofs cups ip6tables killall mysql-mmm-agent nfs openstack-cinder-api quota_nld rpcidmapd smartd ypbind abrtd blk-availability functions iptables lvm2-lvmetad mysql-mmm-monitor nfslock openstack-cinder-backup rdisc rpcsvcgssd sshd abrt-oops certmonger haldaemon irqbalance lvm2-monitor mysql-proxy ntpd openstack-cinder-scheduler restorecond rsyslog sssd acpid cgconfig halt iscsi mcelogd netconsole ntpdate openstack-cinder-volume rngd sandbox tgtd atd cgred htcacheclean iscsid mdmonitor netfs numad portreserve rpcbind saslauthd udev-post auditd cpuspeed httpd kdump messagebus network oddjobd psacct rpcgssd single winbind [root@test init.d]# pwd /etc/init.d
那找下/usr/bin目录,里面虽然有mysql但还是启动不了
[root@test bin]# service mysql start mysql: unrecognized service [root@test bin]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) [root@test bin]# pwd /usr/bin
而在/bin里面没有mysql。
所以我百思不得其解到处请教,查资料,都不能解决。正当苦恼之时,偶然灵光一闪干脆在5.1的基础上升级mysql不知道能否实现,死马当活马医。当然了首先要移除已经装好的mysql。
[root@test /]# yum remove -y mysql* Loaded plugins: fastestmirror, security Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.5.43-1.el6.remi will be erased ---> Package mysql++.x86_64 0:3.1.0-7.el6.remi will be erased ---> Package mysql++-manuals.x86_64 0:3.1.0-7.el6.remi will be erased ---> Package mysql-connector-c++.x86_64 0:1.1.2-1.el6.remi will be erased ---> Package mysql-connector-java.noarch 1:5.1.17-6.el6 will be erased ---> Package mysql-connector-odbc.x86_64 0:5.1.5r1144-7.el6 will be erased ---> Package mysql-connector-python.noarch 0:1.1.6-1.el6.remi will be erased ---> Package mysql-embedded.x86_64 0:5.5.43-1.el6.remi will be erased ---> Package mysql-libs.x86_64 0:5.5.43-1.el6.remi will be erased ---> Package mysql-mmm.noarch 0:2.2.1-2.el6 will be erased ---> Package mysql-mmm-agent.noarch 0:2.2.1-2.el6 will be erased ---> Package mysql-mmm-monitor.noarch 0:2.2.1-2.el6 will be erased ---> Package mysql-mmm-tools.noarch 0:2.2.1-2.el6 will be erased ---> Package mysql-proxy.x86_64 0:0.8.5-1.el6 will be erased ---> Package mysql-proxy-devel.x86_64 0:0.8.5-1.el6 will be erased ---> Package mysql-utilities.noarch 0:1.3.6-1.el6.remi will be erased ---> Package mysqlnd-qc-panel.noarch 0:1.2.0-4.el6.remi.5.4 will be erased ---> Package mysqlreport.noarch 0:3.5-4.el6 will be erased --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================================================================== Removing: mysql x86_64 5.5.43-1.el6.remi @remi 29 M mysql++ x86_64 3.1.0-7.el6.remi @remi 470 k mysql++-manuals x86_64 3.1.0-7.el6.remi @remi 4.1 M mysql-connector-c++ x86_64 1.1.2-1.el6.remi @remi 963 k mysql-connector-java noarch 1:5.1.17-6.el6 @base 2.8 M mysql-connector-odbc x86_64 5.1.5r1144-7.el6 @base 345 k mysql-connector-python noarch 1.1.6-1.el6.remi @remi 638 k mysql-embedded x86_64 5.5.43-1.el6.remi @remi 11 M mysql-libs x86_64 5.5.43-1.el6.remi @remi 4.1 M mysql-mmm noarch 2.2.1-2.el6 @epel 275 k mysql-mmm-agent noarch Loaded plugins: fastestmirror, security Setting up Install Process Loading mirror speeds from cached hostfile * epel: mirrors.ustc.edu.cn * remi: fr2.rpmfind.net Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.5.43-1.el6.remi will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================================================================== Installing: mysql x86_64 5.5.43-1.el6.remi remi 5.8 M Transaction Summary ========================================================================================================================================================================================================== Install 1 Package(s) Total download size: 5.8 M Installed size: 29 M Downloading Packages: mysql-5.5.43-1.el6.remi.x86_64.rpm | 5.8 MB 07:23 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mysql-5.5.43-1.el6.remi.x86_64 1/1 Verifying : mysql-5.5.43-1.el6.remi.x86_64 1/1 Installed: mysql.x86_64 0:5.5.43-1.el6.remi Complete!
由于中间安装过程有点长时间有点多就不向展示安装过程了
当安装结束,首先启动mysqld:
[root@test init.d]# cd /etc/init.d [root@test init.d]# service mysqld start Starting mysqld: [ OK ]
然后就可以使用mysql了,但是奇怪的是启动mysql的命令是mysql而不是以前用过个service mysql start(ps:希望哪位大神能够帮忙解答下)
[root@test /]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.5.43 MySQL Community Server (GPL) by Remi Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
好了,5.5版本的mysql成功的安装了,奇怪的是启动的命令,我也是稀里糊涂的。。。希望哪位大神能够帮忙解释下,万分感谢。。。
这篇文章写的第二篇文章。。。里面有许许多多的不足之处,希望给位前辈们指出不足之处,万分感谢。。。