在
Linux
下安装
mysql
的二进制源代码包
在
Linux
下安装
mysql
的二进制源代码包,看看我的安装步骤吧!
1.
下载
mysql-max- 5.0.24 -linux-i686.tar.gz
,下载地址为
http://www.filewatcher.com/
2.
把下载的文件放在你的
/home/soft
目录
在终端输入
ls,
如下
:
[root@MysqlDBServer soft]# ls
mysql-max- 5.0.24 -linux-i686.tar.gz
3.
然后用
tar -zxvf mysql-max- 5.0.24 -linux-i686.tar.gz
命令解压到当前目录
[root@localhost mysql]# tar �Czxvf mysql-max- 5.0.24 -linux-i686.tar.gz
[root@MysqlDBServer soft]# ls
mysql-max- 5.0.24 -linux-i686 mysql-max-5.0.24-linux-i686.tar.gz
4.
因为用的是源代码,所以要把文件
copy
到安装目录
/usr/local/
下,才能运行
!
[root@localhost mysql]# cp �Crf 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
)
5.
查看系统有没有安装过
mysql,
查找并删除原来的
rpm
形式的
mysql
[root@localhost mysql]# rpm �Cqa | 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
这里
.
6.
建立
mysql
用户
[root@localhost mysql]#useradd mysql
[root@localhost mysql]#passwd mysql(
密码为
mysql)
7.
初始化
mysql
表格,安装
mysql
默认数据库,如下:
[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 &
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]#
8.
修改目录权限,如下:
[root@localhost mysql]# cd /usr/local
[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/
9.
启动
mysql_safe,
如下:
[root@localhost local]# bin/mysqld_safe --user=mysql --socket=/tmp/mysql.sock --port=3306 &
[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.
添加到系统自启动,如下
:
[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.
启动
mysql
服务进程
,
如下
:
[root@localhost local]# /etc/init.d/mysqld start
Starting MySQL [ OK ]