第一章 MySql的安装 1.1

第一章 MySql的安装 

前言:没有MySql,MySqlDBA也无从入手,工欲善其事,必先利其器!

1、查看系统

uname -a

 Linux tech80192 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686 GNU/Linux

file /sbin/init

/sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped

 

足以证明,此机器为32位系统!

2、最简单安装

sudo apt-get install mysql-server

helloword:~# sudo apt-get install mysql-server

Reading package lists... Done

........中间省略                                                        

Fetched 46.4MB in 27s (1660kB/s)                                                                                                  

Preconfiguring packages ...

安装过程会让你输入root密码

登陆命令:

mysql -h127.0.0.1 -uroot -phello

-h:表示host

-u:表示用于

-p:表示密码

 

3、源码安装

到官方网站:http://dev.mysql.com/downloads/mysql/#downloads

如图所示:本实例下载了最后一个

 

   wps_clip_image-24690

 

下载源码包

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.50.tar.gz/from/http://gd.tuwien.ac.at/db/mysql/

 

默认保存为:mysql-5.1.50.tar.gz

下载完毕,tar -zxvf mysql-5.1.50.tar.gz命令解压到当前目录

cd tar -zxvf mysql-5.1.50

创建mysql组,建立mysql用户并加入到mysql组中

groupadd mysql

useradd -g mysql mysql

 

mysql安装

tar -zxvf mysql-5.1.50.tar.gz
tech80192:/home/download# cd mysql-5.1.50
tech80192:/home/download/mysql-5.1.50#
tech80192:/home/download/mysql-5.1.50# ./configure --prefix=/home/mysql
........中间省略   

遇到第一个错误:
/bin/rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands

tech80192:/home/download/mysql-5.1.50# ./libtool --version
ltmain.sh (GNU libtool) 2.2.6
Written by Gordon Matzigkeit <[email protected]>, 1996

Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

网上搜索 一些,
官方解决办法:http://bugs.mysql.com/bug.php?id=47411
需要安装几个包

之后执行
# autoreconf --force --install
# libtoolize --automake --force
# automake --force --add-missing

再执行
# ./configure --prefix=/home/mysql
执 行完发现,还是报同样的错误
网上也找到一些答案http://bugs.debian.org/cgi-bin /bugreport.cgi?bug=523750
还好有一招狠的:
将configure 中的 文件更改:
$RM "$cfgfile"
改为:       
$RM -f "$cfgfile"
最见效,至于为什么,好好去想想 吧,O(∩_∩)O~

ok,我们继续吧:
./configure --prefix=/home/mysql
make
make install
终于安装成功啦!

启 动mysql
tech80192:/home/mysql# /home/mysql/bin/mysqld_safe --user=mysql &
[1] 31212
tech80192:/home/mysql# 100826 20:46:10 mysqld_safe Logging to '/var/lib/mysql/tech80192.err'.
100826 20:46:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100826 20:46:10 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
又报错,查看:
cat /var/lib/mysql/tech80192.err
100826 20:46:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100826 20:46:10 [ERROR] Error message file '/usr/share/mysql/english/errmsg.sys' had only 475 error messages,
but it should contain at least 641 error messages.
Check that the above file is the right version for this program!
/home/mysql/libexec/mysqld: Unknown error 1146
100826 20:46:10 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
100826 20:46:10 [ERROR] /home/mysql/libexec/mysqld: unknown option '--skip-bdb'
100826 20:46:10 [ERROR] Aborting

100826 20:46:10 [Note]
100826 20:46:10 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

发现两个错误:
1、/usr/share/mysql/english/errmsg.sys

找 到:/home/mysql/share/mysql/english/errmsg.sys
做个软连接吧,
ln -s /home/mysql/share/mysql/english/errmsg.sys /usr/share/mysql/english/errmsg.sys

2、unknown option '--skip-bdb'
找到:
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
#skip-bdb
注释掉

再启动试试,又报错
100826 20:52:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/home/mysql/libexec/mysqld: Table 'mysql.plugin' doesn't exist
100826 20:52:43 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
100826 20:52:43 [ERROR] Can't start server : Bind on unix socket: Permission denied
100826 20:52:43 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
100826 20:52:43 [ERROR] Aborting

100826 20:52:43 [Note] /home/mysql/libexec/mysqld: Shutdown complete

100826 20:52:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

想起来了,,重要的东西没有初始化!

创 建mysql许可表:
/home/mysql/bin/mysql_install_db --user=mysql
tech80192:/home/mysql# /home/mysql/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
100826 20:59:42 [Warning] /usr/sbin/mysqld: unknown option '--loose-skip-innodb'

100826 20:59:42 [Warning] /usr/sbin/mysqld: unknown option '--loose-skip-ndbcluster'

100826 20:59:42  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

Installation of system tables failed!  Examine the logs in
/var/lib/mysql for more information.

You can try to start the mysqld daemon with:

    shell&gt; /usr/sbin/mysqld --skip-grant &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell&gt; /usr/bin/mysql -u root mysql
    mysql&gt; show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /var/lib/mysql that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us!  And remember, if
you do mail us, you MUST use the /usr/scripts/mysqlbug script!

………未完待续。。。。。。。

 

 

你可能感兴趣的:(mysql,数据库,职场,休闲)