Compile and install mysql5.5 on FreeBSD

Source: Internet
Author: User

 

Mysql5.5 uses the new configuration tool cmake. Therefore, during compilation and installation, make sure that cmake has been installed in your system, the redhat system can be viewed using rpm-qa | grep cmake. Another simple method is to directly enter cmake to determine whether to install the tool.

If your system does not have cmakeinstalled, download the cmake-2.8.5.tar.gz source code package. For more information, see the attachment.

Tar zxvf cmake-2.8.5.tar.gz

Cd cmake-2.8.5

./Configure

Make & make install

After cmake is installed, you can proceed.

The procedure is as follows:

1. Copy the mysql source code package mysql-5.5.11.tar.gz to your Linux system,

Tar zxvf mysql-5.5.11.tar.gz

Cd mysql-5.5.11

2. Configure mysql5.5 compilation Parameters

Ccmake. // use ccmake to edit the configuration parameters, or use cmake.-option to configure the parameters. Use ccmake. For example, the configuration interface is convenient, but there are few configurable items;

 

There are many options to use cmake.-option. Some common Parameter options are listed below:

-DCMAKE_INSTALL_PREFIX = dir_name // mysql installation path

-DMYSQL_DATADIR = dir_name // mysql database path

-DWITH_INNOBASE_STORAGE_ENGINE = 1

-DWITH_ARCHIVE_STORAGE_ENGINE = 1

-DWITH_BLACKHOLE_STORAGE_ENGINE = 1

-DWITH_PERFSCHEMA_STORAGE_ENGINE = 1 // storage engine to be installed in mysql

-DWITHOUT_EXAMPLE_STORAGE_ENGINE = 1 // storage engine not installed in mysql

-DMYSQL_TCP_PORT = port_num // specify the mysql listening port

-DDEFAULT_CHARSET = charset_name // default character of mysql

-DWITH_EXTRA_CHARSETS = name // extended characters of mysql

The above only lists some of the most common options. For detailed parameter descriptions, you can check the INSTALL-SOURCE file in the SOURCE package. The following is a configuration instance:

Cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mysql5.5-plugin = 1-DDEFAULT_CHARSET = gbk-DDEFAULT_COLLATION = gbk_chinese_ci-DWITH_EXTRA_CHARSETS = ALL

Note: During configuration,-DDEFAULT_COLLATION = gbk_chinese_ci indicates that the default Character Set of mysql is gbk_chinese_ci, and-DDEFAULT_CHARSET = gbk indicates that the default character is gbk. Both must be configured at the same time, otherwise, an error is reported during database initialization, prompting that the character set cannot be found. When the configuration is complete, you can use cmake. -LH: Check your configuration information. If you find any problem, use cmake. -option to change, which is used in the previous mysql version. /configure to configure mysql compilation parameters that are not available.

3. make & make install // compile and install mysql. It is obvious that this process is much faster than before mysql5.5.

4. adduser // create a mysql user, create a user in freeDSB, and use adduser. Then Interactive User Creation settings will appear.

5. cp/usr/local/mysql5.5/support-files/my-large.cnf/etc/my. cnf // copy the profile template, under the support-files folder there are my-huge.cnf, my-innodb-heavy-4G.cnf, my-large.cnf, my-medium.cnf, my-small.cnf five profile templates, you can select an appropriate configuration file template based on your system's memory.

6. chown-R mysql/usr/local/mysql5.5

Chgrp-R mysql/usr/local/mysql5.5/data // Set Directory Permissions

7./usr/local/mysql5.5/scripts/mysql_install_db-user = mysql // initialize the database. The following error occurs. Therefore, you must specify the mysql path and mysql data path when initializing the database.

 

Example:/usr/local/mysql5.5/scripts/mysql_install_db -- basedir =/usr/local/mysql5.5 -- datadir =/usr/local/mysql5.5/data -- user = mysql

8./usr/local/mysql5.5/bin/mysqld_safe-user = mysql & // start the mysql server

9./usr/local/mysql5.5/bin/mysql // connect to the mysql server

Related Article

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.