您的位置:首页 > 数据库 > MySQL

mysql在debian安装

2011-11-29 22:32 148 查看
1.安装gcc,gdb, libncurses5-dev

apt-get install make gcc

2.groupadd mysql

useradd -g mysql mysql

./configure --prefix=/home/mysql --with-mysqld-user=mysql && make && make install

3.cp support-files/my-medium.cnf /etc/my.cnf

cp /home/mysql/share/mysql/mysql.server /etc/init.d/mysqld

修改my.cnf打开innodb选项

/etc/init.d/mysqld start

mysqladmin -u root password '******'

/sbin/chkconfig --add mysqld

# cd /mnt/

# tar zxvf mysql-5.0.84.tar.gz

# cd mysql-5.0.84

# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-local-infile --with-low-memory

说明:安装到=/usr/local/mysql 下,<a class="vLink9999" title="%u8425%u517B%u98DF%u8DB3 @utops.cc" style="font-size: 1em" target="_blank" onxxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){this.title='amp;apos;#39;'amp;apos;#39;;window.clearTimeout(hideTO);showTitle(event,
this, 2,'amp;apos;#39;'amp;apos;#39;);}" onxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){mouseIsOverLayer = false; mouseOverWhileLoad = false; hideTO = window.setTimeout('amp;apos;#39;checkIfMouseOverLayer()'amp;apos;#39;,500);}"
href="http://action.utops.cc/click.jsp?adsId=104&adsLeagueId=5&adsUserId=188&siteId=657&siteLeagueId=5&siteUserId=564&scId=2&adsType=2&prices=0.8&checkCode=d3d4201b7ece5c1ceb28f4170a1d5ed0_222.73.161.244&click=1&url=http%3A//www.abbottmama.com.cn/yingyangshizu/&v=0&keyword=%u8BED%u8A00&s=http%3A//www.linuxidc.com/Linux/2009-12/23230p2.htm&rn=781751---2010-4-14-10:46:22">语言用utf8

通到错误 :configure: error: no acceptable C compiler found in $PATH

说明没安gcc, <a class="vLink9999" title="%u52A8%u6F2B_1 @utops.cc" style="font-size: 1em" target="_blank" onxxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){this.title='amp;apos;#39;'amp;apos;#39;;window.clearTimeout(hideTO);showTitle(event,
this, 1,'amp;apos;#39;'amp;apos;#39;);}" onxxxxxxxx="if(typeof(showTitle)!='amp;apos;#39;undefined'amp;apos;#39;){mouseIsOverLayer = false; mouseOverWhileLoad = false; hideTO = window.setTimeout('amp;apos;#39;checkIfMouseOverLayer()'amp;apos;#39;,500);}"
href="http://action.utops.cc/click.jsp?adsId=412&adsLeagueId=5&adsUserId=1&siteId=657&siteLeagueId=5&siteUserId=564&scId=2&adsType=98&prices=1.51&checkCode=584773c37c55abe0109d8f59eed46f50_222.73.161.244&click=1&url=http%3A//www.foho.cc/totole/index.html&v=0&keyword=%u73B0%u5728&s=http%3A//www.linuxidc.com/Linux/2009-12/23230p2.htm&rn=895018---2010-4-14-10:46:22">现在安:

查看系统是否安装了gcc和安装程序的版本号:

gcc -v c++ -v g++ -v 如果没有就用 以下命令安装#yum install gcc #yum install gcc-c++ #yum install gcc-gfortran

再次:

# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-local-infile --with-low-memory

还是出错:

checking for termcap functions library... configure: error: No curses/termcap library found

说明要安ncurses

#yum install ncurses-devel

提示安装N个软件,略, 按"y", 完成

再次:

# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-local-infile --with-low-memory

出现:Thank you for choosing MySQL! 说明mysql安装的第一步成功

------------

# make && make install

如果 你的gcc-c++是在configure后安装的,再重新configure一下,可以会以下错误:

error: redeclaration of C++ built-in type ‘bool’

慢长的等待,安好了

groupadd mysql

useradd -g mysql mysql

cd /usr/local

mkdir mysql

下载源码:

cd /usr/src

wget http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.85.tar.gz
tar -xzvf mysql-5.0.85.tar.gz

cd mysql-5.0.85

编译参数(参照简朝阳前辈):

./configure --prefix=/usr/local/mysql/ --without-debug --without-bench --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-charset=latin1 --with-extra-charset=utf8,gbk --with-innodb --with-cvs-storage-engine
--with-federated-storage-engine --with-mysqld-user=mysql --without-embedded-server --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/sock/mysql.sock

出了点小错:

checking for termcap functions library... configure: error: No curses/termcap library found

解决方法:

sudo apt-get install libncurses5-dev

继续configure

....

make

...(屏幕疯狂的刷了15分钟)

make install

...

收尾设置:

cp support-files/my-medium.cnf /etc/my.cnf

cd /usr/local/mysql

chown -R mysql .

chgrp -R mysql .

安装初始数据库:

bin/mysql_install_db --user=mysql

chown -R root .

chown -R mysql var

bin/mysqld_safe --user=mysql

添加mysql root密码:

/usr/local/mysql/bin/mysqladmin -u root password '12346'

添加启动文件:

cp ./support-files/mysql.server /etc/init.d/mysql

chmod 777 /etc/init.d/mysql

把mysql/bin添加到$PATH变量中:

export PATH=/usr/local/mysql/bin/:$PATH

或者修改/etc/profile文件

测试:

/etc/init.d/mysqld start

mysql -u root -p12346

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| test |

+--------------------+

3 rows in set (0.04 sec)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: