天天看点

在Linuxas4u5下安装mysql的二进制源代码包

<b>在</b><b>Linux</b><b>下安装</b><b>mysql</b><b>的二进制源代码包</b>

在Linux下安装mysql的二进制源代码包,看看我的安装步骤吧!

<b>1.         </b><b>下载</b>

<b>2.         </b><b>把下载的文件放在你的</b><b>/home/soft</b><b>目录</b>

在终端输入ls,如下:

[root@MysqlDBServer soft]# ls

mysql-max-5.0.24-linux-i686.tar.gz

<b>3.         </b><b>然后用</b><b>tar -zxvf mysql-max-5.0.24-linux-i686.tar.gz</b><b>命令解压到当前目录</b>

[root@localhost mysql]# tar –zxvf mysql-max-5.0.24-linux-i686.tar.gz

mysql-max-5.0.24-linux-i686  mysql-max-5.0.24-linux-i686.tar.gz

<b>4.         </b><b>因为用的是源代码,所以要把文件</b><b>copy</b><b>到安装目录</b><b>/usr/local/</b><b>下,才能运行</b><b>!</b>

[root@localhost mysql]# cp –rf mysql-max-5.0.24-linux-i686 /usr/local/

[root@localhost mysql]# cd /usr/local

[root@db2 local]# mv mysql-max-5.0.24-linux-i686 mysql(目录改名成mysql)

<b>5.         </b><b>查看系统有没有安装过</b><b>mysql,</b><b>查找并删除原来的</b><b>rpm</b><b>形式的</b><b>mysql</b>

[root@localhost mysql]# rpm –qa | grep mysql

有的话一个一个删除掉,用rpm -e命令,然后查找一下残留的文件:

[root@localhost mysql]# cd /

[root@localhost /]# find / -name mysql

如果查找到rm -rf filename删除.

[root@localhost /]# find / -name my.cnf

如果查找到删除,一般my.cnf是在/etc/my.cnf这里.

<b>6.         </b><b>建立</b><b>mysql</b><b>用户</b>

[root@localhost mysql]#useradd mysql

[root@localhost mysql]#passwd mysql(密码为mysql)

7.         <b>初始化</b><b>mysql</b><b>表格,安装</b><b> mysql </b><b>默认数据库,如下:</b>

[root@localhost mysql]# cd /usr/local/mysql

Installing all prepared tables

Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server

to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'

./bin/mysqladmin -u root -h MysqlDBServer password 'new-password'

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &amp;

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:

cd sql-bench ; perl run-all-tests

Please report any problems with the ./bin/mysqlbug .!

The latest information about MySQL is available . the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

[root@MysqlDBServer mysql]#

<b>8.         </b><b>修改目录权限,如下:</b>

[root@localhost local]# chgrp -R mysql mysql

[root@localhost local]# chown -R mysql mysql/data

[root@localhost local]# ln -sv /usr/local/mysql/bin/* /usr/local/bin/

<b>9.         </b><b>启动</b><b>mysql_safe,</b><b>如下:</b>

[root@localhost local]# bin/mysqld_safe --user=mysql --socket=/tmp/mysql.sock --port=3306 &amp;

[1] 26860

[root@localhost local]# nohup: ignoring input and redirecting stderr to stdout

Starting mysqld daemon with databases from /usr/local/mysql/data

查看一下 3308 端口是否已经在监听:

netstat -anp|grep LISTEN

10.     <b>添加到系统自启动,如下</b>:

[root@localhost local]# cp mysql/support-files/mysql.server  /etc/rc.d/init.d/mysqld

[root@localhost local]# chkconfig --add mysqld

查看启动进程列表

[root@MysqlDBServer soft]# chkconfig --list|grep mysqld

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

11.     <b>启动</b><b>mysql</b><b>服务进程</b><b>,</b><b>如下</b>:

[root@localhost local]# /etc/init.d/mysqld start

Starting MySQL                                             [  OK  ]

本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/126016

继续阅读