Compile and install MySQL 5.5.9 in Ubuntu

Source: Internet
Author: User

The source code version of ghost, so far there is no ubuntu installation source, I am not very familiar with rpm, so I can only compile the source code to install, refer to the online compilation and installation options, tried several times, finally, I made a note.

5.5.9 use cmake for compilation. In Ubuntu, only sudo apt-get install cmake can be used. The specific mysql compilation options are as follows (# copy them later ):

Root @ ubuntu :~ /Downloads/mysql-5.5.9 # cmake.-DCMAKE_BUILD_TYPE: STRING = Release-

DCMAKE_INSTALL_PREFIX: PATH =/usr/local/mysql-DCOMMUNITY_BUILD: BOOL = ON

-DENABLED_PROFILING: BOOL = ON-DENABLE_DEBUG_SYNC: BOOL = OFF-

DINSTALL_LAYOUT: STRING = STANDALONE-DMYSQL_DATADIR: PATH =/var/run/mysql

-DMYSQL_MAINTAINER_MODE: BOOL = OFF-DWITH_EMBEDDED_SERVER: BOOL = ON-

DWITH_EXTRA_CHARSETS: STRING = all-DWITH_SSL: STRING = bundled-

DWITH_UNIT_TESTS: BOOL = OFF-DWITH_ZLIB: STRING = bundled-LH

The description of install_source.txt in the source code package

Cd/usr/local/mysql

(Go to the main program directory)

Sudo cp support-files/my-medium.cnf/etc/my. cnf

(Copy the setting file in the source code package to the unified setting file path of the/etc/system. Make sure that you do this step at www.bkjia.com, otherwise install_db will fail)

Sudo ln-s/usr/local/mysql/bin/mysql/usr/bin/

Sudo ln-s/usr/local/mysql/bin/mysqladmin/usr/bin/

Sudo ln-s/usr/local/mysql/bin/mysqld_safe/usr/bin/

Sudo ln-s/usr/local/mysql/bin/mysql_conf/usr/bin/

Sudo ln-s/usr/local/mysql/share/mysql. server/usr/bin/

(Add a soft link to the execution program for convenience. If you prefer to use the full path, you can skip this step)

Sudo groupadd mysql

(Create a user group mysql)

Sudo useradd-g mysql

(Create a user mysql under the user group mysql)

Sudo bin/mysql_install_db -- user = mysql

(If you have not installed MySQL, you must create a MySQL authorization table. After creation, you need to manually restart the server)

Sudo chown-R root.

(Make all files in the/usr/local/mysql/directory owned by the root user root)

Sudo chown-R mysql var

(Make all files in the/usr/local/mysql/var/directory belong to the user mysql)

Sudo chgrp-R mysql.

(Make all the files in the/usr/local/mysql/directory belong to the user group mysql, And I think using root is also acceptable)

Sudo bin/mysql_safe -- use = mysql &

(Initialize and test your mysql, where & indicates execution in the background)

After installation, the server starts properly. If no soft link is added to the execution program above,/usr/local/mysql is not in the PATH and/usr/local/mysql/bin/mysqld is started every time, you can add the/usr/local/mysql/bin PATH to PATH and modify the/etc/environment file in Ubuntu. Pay attention to the writing method. If the file is incorrect, ubuntu may not start again.

Ii. Start Mysql Server

Mysql_config

Or

Mysqld_safe -- user = mysql &

Or

Mysql. server start

Set auto-start

1. sudo cp/usr/local/mysql/share/mysql. server/etc/init. d/mysql

2. sudo chmod + x mysql

3. sudo sysv-rc-conf

(Run the service management tool. If you do not have sysv-rc-conf, you can install sudo apt-get install sysv-rc-conf immediately, for more information about how to use sysc-rc-conf, see <use sysv-rc-conf to manage services in Ubuntu10.10>)

4. Run sysv-rc-conf, find mysql, and set a runtime level for it. I set it to 2345.

Add a Mysql user password

1. Make sure that the Mysql Server is started.

2. mysql-u root-p

3. set password for 'root' @ 'localhost' = PASSWORD ('newpwd ');

4. set password for 'root' @ 'hostname' = PASSWORD ('newpwd ');

(Hostname is your host name, depending on the actual situation)

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.