前言:沒有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
如圖所示:本執行個體下載下傳了最後一個
下載下傳源碼包
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
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 [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]
發現兩個錯誤:
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> /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> /usr/bin/mysql -u root mysql
mysql> 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!
………未完待續。。。。。。。
本文轉自jooben 51CTO部落格,原文連結:http://blog.51cto.com/jooben/383674