1、myql下载
[plain] view plaincopyprint?
1. [root@linux download]# wget -c http://mirror.provenscaling.com/mysql/community/source/5.1/mysql-5.1.28-rc.tar.gz
2、解压缩
[root@linux download]# tar -zxvf mysql-5.1.28-rc
3、编译安装
[plain] view plaincopyprint?
1. [root@linux mysql-5.1.28-rc]# cd mysql-5.1.28-rc
2. [root@linux mysql-5.1.28-rc]# ./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-thread-safe-client --enable-assembler --with-charset=utf8 --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
配置的具体意义,可以通过./configure --help 获取帮助
[plain] view plaincopyprint?
1. [root@linux mysql-5.1.28-rc]# make && make install
4、添加用户/组
[plain] view plaincopyprint?
1. [root@linux mysql-5.1.28-rc]# groupadd mysql
2. [root@linux mysql-5.1.28-rc]# useradd -s /sbin/nologin -M -g mysql mysql
5、编辑配置文件my.cnf
[plain] view plaincopyprint?
1. [root@linux ~]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
2. [root@linux ~]# sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf
6、安装数据库
[plain] view plaincopyprint?
1. [root@linux ~]# /usr/local/mysql/bin/mysql_install_db --user=mysql
7、设置文件宿主
[plain] view plaincopyprint?
1. [root@linux ~]# chown -R mysql /usr/local/mysql/var
2. [root@linux ~]# chgrp -R mysql /usr/local/mysql/.
8、设置服务
[plain] view plaincopyprint?
1. [root@linux ~]# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
2. [root@linux ~]# chmod 755 /etc/init.d/mysql
3. <PRE class=plain name="code">[root@linux ~]# chkconfig --level 345 mysql on</PRE>
4. <PRE></PRE>
5. <BR>
6. <PRE class=plain name="code">[root@linux ~]# cat > /etc/ld.so.conf.d/mysql.conf<<EOF
7. > /usr/local/mysql/lib/mysql
8. > /usr/local/lib
9. > EOF
10. [root@linux ~]# ldconfig
11.
12. [root@linux ~]# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
13. [root@linux ~]# ln -s /usr/local/mysql/include/mysql /usr/include/mysql
14. </PRE>9、启动服务<PRE class=plain name="code">[root@linux ~]# /etc/init.d/mysql start
15. 或
16. <PRE class=plain name="code">[root@linux ~]# service mysql start</PRE>
17. <PRE></PRE>
18. <P>10、设置为开机自启动</P>
19. <PRE class=plain name="code">[root@localhost ~]# cat >> /etc/rc.d/rc.local
20. /etc/init.d/mysql start</PRE>
21. <P>11、设置符号链接<BR>
22. </P>
23. <PRE class=plain name="code">[root@linux ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
24. [root@linux ~]# ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
25. [root@linux ~]# ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk</PRE>12.设置密码<PRE class=plain name="code">[root@linux ~]# /usr/local/mysql/bin/mysqladmin -u root password 12345
26. [root@linux ~]# /etc/init.d/mysql restart</PRE><BR>
27. <BR>
28. <PRE></PRE>
29. <PRE></PRE>
30. <PRE></PRE>
31.
32. </PRE>
[plain] view plaincopyprint?
1. [root@linux download]# wget -c http://mirror.provenscaling.com/mysql/community/source/5.1/mysql-5.1.28-rc.tar.gz
2、解压缩
[root@linux download]# tar -zxvf mysql-5.1.28-rc
3、编译安装
[plain] view plaincopyprint?
1. [root@linux mysql-5.1.28-rc]# cd mysql-5.1.28-rc
2. [root@linux mysql-5.1.28-rc]# ./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-thread-safe-client --enable-assembler --with-charset=utf8 --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
配置的具体意义,可以通过./configure --help 获取帮助
[plain] view plaincopyprint?
1. [root@linux mysql-5.1.28-rc]# make && make install
4、添加用户/组
[plain] view plaincopyprint?
1. [root@linux mysql-5.1.28-rc]# groupadd mysql
2. [root@linux mysql-5.1.28-rc]# useradd -s /sbin/nologin -M -g mysql mysql
5、编辑配置文件my.cnf
[plain] view plaincopyprint?
1. [root@linux ~]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
2. [root@linux ~]# sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf
6、安装数据库
[plain] view plaincopyprint?
1. [root@linux ~]# /usr/local/mysql/bin/mysql_install_db --user=mysql
7、设置文件宿主
[plain] view plaincopyprint?
1. [root@linux ~]# chown -R mysql /usr/local/mysql/var
2. [root@linux ~]# chgrp -R mysql /usr/local/mysql/.
8、设置服务
[plain] view plaincopyprint?
1. [root@linux ~]# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
2. [root@linux ~]# chmod 755 /etc/init.d/mysql
3. <PRE class=plain name="code">[root@linux ~]# chkconfig --level 345 mysql on</PRE>
4. <PRE></PRE>
5. <BR>
6. <PRE class=plain name="code">[root@linux ~]# cat > /etc/ld.so.conf.d/mysql.conf<<EOF
7. > /usr/local/mysql/lib/mysql
8. > /usr/local/lib
9. > EOF
10. [root@linux ~]# ldconfig
11.
12. [root@linux ~]# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
13. [root@linux ~]# ln -s /usr/local/mysql/include/mysql /usr/include/mysql
14. </PRE>9、启动服务<PRE class=plain name="code">[root@linux ~]# /etc/init.d/mysql start
15. 或
16. <PRE class=plain name="code">[root@linux ~]# service mysql start</PRE>
17. <PRE></PRE>
18. <P>10、设置为开机自启动</P>
19. <PRE class=plain name="code">[root@localhost ~]# cat >> /etc/rc.d/rc.local
20. /etc/init.d/mysql start</PRE>
21. <P>11、设置符号链接<BR>
22. </P>
23. <PRE class=plain name="code">[root@linux ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
24. [root@linux ~]# ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
25. [root@linux ~]# ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk</PRE>12.设置密码<PRE class=plain name="code">[root@linux ~]# /usr/local/mysql/bin/mysqladmin -u root password 12345
26. [root@linux ~]# /etc/init.d/mysql restart</PRE><BR>
27. <BR>
28. <PRE></PRE>
29. <PRE></PRE>
30. <PRE></PRE>
31.
32. </PRE>