Freebsd mysql compilation and installation mysql5.5.12

Source: Internet
Author: User

 

Download mysql package

Http://dev.mysql.com/downloads/mysql/

Http://download.softagency.net/MySQL/Downloads/MySQL-5.5/

 

Create a mysql installation directory

[Root @ dianzhui ~] # Mkdir/usr/local/mysql5.5.12/

 

Create a mysql account

[Root @ dianzhui ~] # Adduser

......

 

Create a data directory

[Root @ dianzhui ~] # Mkdir/var/mysql

[Root @ dianzhui ~] # Chown mysql. mysql-R/var/mysql

 

Install cmake

Use ports to install cmake

 

Install mysql 5.5.9

[Root @ dianzhui ~] # Tar zxvf mysql-5.5.12.tar.gz

[Root @ dianzhui ~] # Cd mysql-5.5.12

[Root @ dianzhui mysql-5.5.12] # cmake ./

-DCMAKE_INSTALL_PREFIX =/usr/local/mysql5.5.12 //

-DMYSQL_DATADIR =/var/mysql/

-DMYSQL_UNIX_ADDR =/var/mysql/mysqld. sock/

-DWITH_INNOBASE_STORAGE_ENGINE = 1/

-DENABLED_LOCAL_INFILE = 1/

-DMYSQL_TCP_PORT = 3306/

-DEXTRA_CHARSETS = all/

-DDEFAULT_CHARSET = utf8/

-DDEFAULT_COLLATION = utf8_general_ci/

-DMYSQL_UNIX_ADDR =/var/mysql. sock/

-DMYSQL_USER = mysql/

-DWITH_DEBUG = 0

 

Note: It is best to remove the following two lines to avoid coding errors.

-DDEFAULT_CHARSET = utf8/

-DDEFAULT_COLLATION = utf8_general_ci/

 

[Root @ dianzhui mysql-5.5.12] # make

[Root @ dianzhui mysql-5.5.12] # make install

Copy the configuration file

[Root @ dianzhui mysql-5.5.12] # cp support-files/my-medium.cnf/usr/local/etc/my. cnf

 

Copy the Startup Script

[Root @ dianzhui mysql-5.5.12] # cp support-files/mysql. server/usr/local/etc/rc. d/mysqld

[Root @ dianzhui mysql-5.5.12] # chmod 755/usr/local/etc/rc. d/mysqld

 

Initialize the database (go to the installation directory)

[Root @ dianzhui mysql-5.5.12] # cd/usr/local/mysql5.5.12

[Root @ dianzhui mysql5.5.12] # scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql5.5.12 -- datadir =/var/mysql/

 

Start Database

[Root @ dianzhui mysql5.5.12] #/usr/local/etc/rc. d/mysqld start

 

Change root Password

[Root @ kevin mysql5.5.12] #/usr/local/mysql5.5.12/bin/mysqladmin-u root password 'new-password'

 

If an error occurs during startup, go to the database directory to view the error log.

 

Copy to Environment Variable

Cp mysql mysqladmin mysqld_safe mysqldump/usr/sbin/

 

Adding the startup Item File

[Root @ Kevin mysql5.5.12] # Vim/etc/rc. conf

 

Mysql_enable = "yes"

Mysql_dbdir = "/var/MySQL"

 

 

Reference, pig:

Select profile description: http://www.workle.cn/space.php? Uid = 1 & Do = Blog & id = 336.

Compile and install MySQL 5.5.9: http://crazyming.blog.51cto.com/1048571/510659

 

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.