Compile and install mysql5.5 in Linux

Source: Internet
Author: User

Install the software needed: mysql source code file: mysql-5.5.19.tar.gzwget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.19.tar.gz/from/http://mysql.he.net/cmake (Version 5.5 useless with configure compiled) wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gzbison is not installed, the compiler will have a warning) wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gzGNU m4 not installed cannot install bison) http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gzncurses-develyuminstallation) gcc-c ++ (yum installation) 1. create YUM (because yum can well solve the dependency in LINUX) and directly use the 163 YUM source vi/etc/yum/pluginconf. d/fastestmirror. conf set enable = 0cd/etc/yum. repos. d/wget heep: // mirrors.163.com/.help/CentOS6-Base-163.repoyum makecacheyum update (if the update is faulty, rename/lib/modules/2.6.32-71. el6.i686/kernel/net/ipv6: mv/lib/modules/2.6.x/kernel/net/ipv6/lib/modules/2.6.x/kernel/net/ipv6.bak and restart) 2. related Description 1) All downloaded files will be saved in the/usr/local/src/directory 2) mysql will run as a mysql user and will be added to the service for automatic start 3) mysql will be installed in the/usr/local/mysql/directory 4) mysql default installation uses utf8 Character Set 5) mysql Data and log files are stored in the/var/mysql/directory 6) mysql configuration files are stored in/var/mysql/my. cnf3. install cmakeyum install gcc-c ++ yum install ncurses-develcd/usr/local/srctar zxvf m4-1.4.16.tar.gzcd m4-1.4.16. /configuremakemake installtar zxvf bison-2.5.tar.gzcd bison-2.5. /configuremakemake installtar zxvf cmake-2.8.4.tar.gzcd cmake-2.8.4. /bootstrapgmakegmake install 3. compile and install MySQL 5.5.19groupadd mysqluseradd-g mysql mysqltar xvf mysql-5.5.19.tar.gzcd mysql-5.5.19/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 \-records = 1 \-records = 1 \-records = 1 \-DWITH_READLINE = 1 \-DENABLED_LOCAL_INFILE = 1 \-DMYSQL_DATADIR =/var/mysql/data \-DMYSQL_USER = mysql note: for more information about the above compilation options, see another BLOG article.) makemake installchmod + w/usr/local/mysqlchown-R mysql: mysql/usr/local/mysqlln-s/usr/local/mysql/lib/libmysqlclient. so.16/usr/lib/libmysqlclient. so.16 mkdir-p/var/mysql/data/mkdir-p/var/mysql/log/chown-R mysql: mysql/var/mysql/cd support-files/cp my-large.cnf/var/mysql/my. cnf Note: Q: Starting MySQL .. the server quit without updating PID file (/var/lib/mysql/localhost. localdomain. pid) A solution: it is actually my. cnf configuration file/etc/my. cnf comes from the following files: If your memory is less than or equal to 64 MB, copy/usr/local/share/mysql/my-small.cnf to/etc/my. cnf # This is for a system with little memory (<= 64 M) where MySQL is only used # from time to time and it's important that the mysqld daemon # doesn't use much resources. if the memory is 128 M, copy/usr/local/share/mysql/my-medium.cnf as/etc/my. cnf # This is for a system with little memory (32 M-64 M) where MySQL plays # an important part, or systems up to 128 M where MySQL is used together with # other programs (such as a web server) if the memory is 512 M, copy/usr/local/share/mysql/my-large.cnf to/etc/my. cnf # This is for a large system with memory = 512 M where the system runs mainly # MySQL. if the memory is 1-2G, copy/usr/local/share/mysql/my-huge.cnf as/etc/my. cnf # This is for a large system with memory of 1G-2G where the system runs mainly # MySQL .) cp mysql. server/etc/init. d/mysqld4. configure to start MySQL 5.5.131) If necessary, first modify mysql configuration my. cnfvi/var/mysql/my. cnf 2) mysql initial installation/usr/local/mysql/scripts/mysql_install_db \ -- defaults-file =/var/mysql/my. cnf \ -- basedir =/usr/local/mysql \ -- datadir =/var/mysql/data \ -- user = mysql3) set the environment variable export PATH =/usr/local/mysql/bin: $ PATH to directly modify the vi/etc/profile global) or the user directory. bashrc File export PATH = "$ PATH:/usr/local/mysql/bin" or directly add several soft connections so that these tools can be used directly, ln-s/usr/local/mysql/bin/mysql/usr/binln-s/usr/local/mysql/bin/mysqldump/usr/binln-s/usr/local /mysql/bin/mysqladmin/usr/bin4) add mysql to start cp support-files/mysql. server/etc/init. d/mysqldchmod + x/etc/init. d/mysqldvi/etc/init. d/mysqld edit this file and find and modify the following variables: basedir =/usr/local/mysqldatadir =/var/mysql/datachkconfig -- add mysqldchkconfig -- level 345 mysqld on5) start mysqlservice mysqld start


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.