无法用指定MySQL客户端登陆服务器的案例分析

习惯了二进制安装MySQL,今天心血来潮想装个RPM包的MySQL玩玩,没想到一装还真碰到了点问题,下面把碰到的问题分享一下

首先去官网下载安装包,地址是:

根据自己的系统版本和平台选择要安装的包,我的测试机是32 bit的 RHEL 5.3

我选择的是5.0.96,挺老的版本了,需要下载一个server包和一个client包,分别为:

MySQL-server-community-5.0.96-1.rhel5.i386

MySQL-client-community-5.0.96-1.rhel5.i386

把这2个包放到服务器/opt目录下

 

一、安装MySQL服务器

 

[root@bak ~]# rpm -ivh /opt/MySQL-server-community-5.0.96-1.rhel5.i386.rpm 

Preparing...                ########################################### [100%]

   1:MySQL-server-community ########################################### [100%]

141017 15:36:11 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set

Installation of system tables failed!

 

Examine the logs in /data/mysql/mysql_3306/data for more information.

You can try to start the mysqld daemon with:

/usr/local/mysql/bin/mysqld --skip-grant &

and use the command line tool

/usr/local/mysql/bin/mysql to connect to the mysql

database and look at the grant tables:

 

shell> /usr/local/mysql/bin/mysql -u root mysql

mysql> show tables

 

Try 'mysqld --help' if you have problems with paths. Using --log

gives you a log in /data/mysql/mysql_3306/data that may be helpful.

 

The latest information about MySQL is available on the web at

Please consult the MySQL manual section: 'Problems running mysql_install_db',

and the manual section that describes problems on your OS.

Another information source is the MySQL email archive.

Please check all of the above before mailing us!

And if you do mail us, you MUST use the /usr/bin/mysqlbug script!

Starting MySQL[  OK  ]    --mysqld进程顺利启动

Giving mysqld 2 seconds to start

[root@bak ~]# ps -ef|grep mysql

root     11883 11838  0 15:28 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe

mysql    12584 11883  0 15:28 pts/2    00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/mysql_3306/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql_3306/data/error.log --open-files-limit=8192 --pid-file=/data/mysql/mysql_3306/data/bak.pid --socket=/tmp/mysql.sock --port=3306

root     13390 11838  0 15:36 pts/2    00:00:00 grep mysql

[root@bak ~]# 

 

安装完包以后会自动去启动mysqld进程,并寻找/etc/my.cnf文件(如果有的话)读取配置,显然我这里原来是有一个的,这是为我的5.5.39的二进制MySQL配置的,而这里已经被读取到了,但我现在装的是5.0.x的RPM版本,使用这个配置文件显然是不适合的,因此先停止mysqld进程,使用自带的配置文件重新去启动服务器进程

 

--停止mysqld进程

[root@bak ~]# service mysql stop

Shutting down MySQL.141017 15:42:12 mysqld_safe mysqld from pid file /data/mysql/mysql_3306/data/bak.pid ended

                                                           [  OK  ]

[1]+  Done                    mysqld_safe

 

--也可以这样停止mysqld进程

[root@bak ~]# /etc/init.d/mysql stop

Shutting down MySQL.                                       [  OK  ]

 

--把原来的配置文件改名,复制5.0.96自带的模板配置文件到/etc/my.cnf

[root@bak ~]# mv /etc/my.cnf /etc/my.cnf-5.5.39

[root@bak ~]# cd /usr/share/mysql

[root@bak mysql]# ll

total 1152

-rwxr-xr-x 1 root root   1153 Mar  3  2012 binary-configure

drwxr-xr-x 2 root root   4096 Oct 17 15:36 charsets

drwxr-xr-x 2 root root   4096 Oct 17 15:36 czech

drwxr-xr-x 2 root root   4096 Oct 17 15:36 danish

drwxr-xr-x 2 root root   4096 Oct 17 15:36 dutch

drwxr-xr-x 2 root root   4096 Oct 17 15:36 english

-rwxr-xr-x 1 root root 346791 Mar  3  2012 errmsg.txt

drwxr-xr-x 2 root root   4096 Oct 17 15:36 estonian

-rwxr-xr-x 1 root root 548013 Mar  3  2012 fill_help_tables.sql

drwxr-xr-x 2 root root   4096 Oct 17 15:36 french

drwxr-xr-x 2 root root   4096 Oct 17 15:36 german

drwxr-xr-x 2 root root   4096 Oct 17 15:36 greek

drwxr-xr-x 2 root root   4096 Oct 17 15:36 hungarian

drwxr-xr-x 2 root root   4096 Oct 17 15:36 italian

drwxr-xr-x 2 root root   4096 Oct 17 15:36 japanese

drwxr-xr-x 2 root root   4096 Oct 17 15:36 korean

-rwxr-xr-x 1 root root   5726 Mar  3  2012 mi_test_all

-rwxr-xr-x 1 root root   1517 Mar  3  2012 mi_test_all.res

-rwxr-xr-x 1 root root   4972 Mar  3  2012 my-huge.cnf

-rwxr-xr-x 1 root root  20970 Mar  3  2012 my-innodb-heavy-4G.cnf

-rwxr-xr-x 1 root root   4948 Mar  3  2012 my-large.cnf

-rwxr-xr-x 1 root root   4955 Mar  3  2012 my-medium.cnf

-rwxr-xr-x 1 root root   2526 Mar  3  2012 my-small.cnf

-rwxr-xr-x 1 root root   1061 Mar  3  2012 mysqld_multi.server

-rwxr-xr-x 1 root root  33106 Mar  3  2012 mysql_fix_privilege_tables.sql

-rwxr-xr-x 1 root root    789 Mar  3  2012 mysql-log-rotate

-rwxr-xr-x 1 root root  11948 Mar  3  2012 mysql.server

-rwxr-xr-x 1 root root   2570 Mar  3  2012 mysql_system_tables_data.sql

-rwxr-xr-x 1 root root  12835 Mar  3  2012 mysql_system_tables.sql

-rwxr-xr-x 1 root root  10371 Mar  3  2012 mysql_test_data_timezone.sql

-rwxr-xr-x 1 root root    589 Mar  3  2012 ndb-config-2-node.ini

-rwxr-xr-x 1 root root   6295 Mar  3  2012 ndb_size.tmpl

drwxr-xr-x 2 root root   4096 Oct 17 15:36 norwegian

drwxr-xr-x 2 root root   4096 Oct 17 15:36 norwegian-ny

drwxr-xr-x 2 root root   4096 Oct 17 15:36 polish

drwxr-xr-x 2 root root   4096 Oct 17 15:36 portuguese

drwxr-xr-x 2 root root   4096 Oct 17 15:36 romanian

drwxr-xr-x 2 root root   4096 Oct 17 15:36 russian

drwxr-xr-x 3 root root   4096 Oct 17 15:36 SELinux

drwxr-xr-x 2 root root   4096 Oct 17 15:36 serbian

drwxr-xr-x 2 root root   4096 Oct 17 15:36 slovak

drwxr-xr-x 2 root root   4096 Oct 17 15:36 spanish

drwxr-xr-x 2 root root   4096 Oct 17 15:36 swedish

drwxr-xr-x 2 root root   4096 Oct 17 15:36 ukrainian

[root@bak mysql]# cp my-medium.cnf /etc/my.cnf

 

--重新启动mysqld进程

[root@bak ~]# /etc/init.d/mysql start

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/209eb7c89bdb1b28ad704950da12e930.html