LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 783|回复: 0

庆祝CentOS6.1发布,发一个源码安装mysql的教程

[复制链接]
发表于 2011-12-18 16:17:44 | 显示全部楼层 |阅读模式
以下命令请用root执行,刚刚测试完毕,可在centos6.1下顺利安装。(Centos最小桌面安装+开发工具)
  1. yum install -y ncurses-devel bison
  2. wget  http://mysql.he.net/Downloads/MySQL-5.5/mysql-5.5.19.tar.gz
  3. wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
  4. groupadd mysql
  5. useradd mysql -g mysql -M -s /sbin/nologin
  6. mkdir -p /usr/local/mysql/data
  7. mkdir -p /usr/local/mysql/log
  8. chmod +w /usr/local/mysql
  9. tar zxvf cmake-2.8.6.tar.gz
  10. tar zxvf mysql-5.5.19.tar.gz
  11. cd cmake-2.8.6
  12. ./bootstrap
  13. gmake
  14. gmake install
  15. cd ../mysql-5.5.19
  16. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql -DWITH_DEBUG=0
  17. make
  18. make install
  19. cp support-files/mysql.server /etc/init.d/mysqld
  20. chmod +x /etc/init.d/mysqld
  21. chown -R mysql:mysql /usr/local/mysql
  22. ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
  23. ln -s /usr/local/mysql/bin/mysql /sbin/mysql
  24. ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
  25. ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
  26. cp support-files/my-huge.cnf /etc/my.cnf -f
  27. /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
  28. chkconfig --add mysqld
  29. chkconfig --level 2345 mysqld on
  30. service mysqld start
  31. mysqladmin -u root password "yourpasswd"
  32. mysql -u root -p
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表