Ubuntu 12.04 64-bit compilation and installation of MySQL 5.5.29

Source: Internet
Author: User

Ubuntu 12.04 64-bit compilation and installation of MySQL 5.5.29

Step 1:
Go to the official mysql website and go down to compile the source code package.

Mysql Website: www.mysql.com

Downloads (MySQL Community Server)

Download the version, select source code, and then find

Generic Linux (Architecture Independent), Compressed TAR Archive   5.5.29 23.7 M Download
(Mysql-5.5.29.tar.gz)

Step 2:

Install several plug-ins first, or the cmake operation fails.
1. apt-get install cmake
2. apt-get install libncurses5-dev (I forgot where this is needed, not when cmake is make, if you have not installed the tool, he will remind you to check the output information)
3. apt-get install gcc c ++ bison libaio1
4. install the basic compilation tool apt-get install build-essential automake autoconf cmake

Decompress, compile, and install the downloaded source code package.
Tar zxvf mysql-5.5.29. tar.gz
Cd mysql-5.5.29
 
5. Run the following command line to compile mysql, which is relatively long. Remember to copy the following multiple lines together to the Command window for compilation.
Cmake \
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DENABLE_DEBUG_SYNC = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DENABLED_PROFILING = 1 \
-DWITH_EMBEDDED_SERVER = 1 \
-DWITH_EXTRA_CHARSETS = all \
-DWITH_LIBWRAP = 1 \
-DWITH_READLINE = 1 \
-DWITH_SSL = yes

6. make
7. make install

8. sudo cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf (copy the configuration file of the original mysql as the configuration file under etc)
9. Edit the my. cnf file to support innodb. (remove the front of the configuration file #) Remove # the following:

  1. # Uncomment the following if you are using InnoDB tables
  2. Innodb_data_home_dir =/home/mysql/3306/data
  3. Innodb_data_file_path = ibdata1: 10 M: autoextend
  4. Innodb_log_group_home_dir =/home/mysql/3306/data
  5. # You can set .. _ buffer_pool_size up to 50-80%
  6. # Of RAM but beware of setting memory usage too high
  7. Innodb_buffer_pool_size = 16 M
  8. Innodb_additional_mem_pool_size = 2 M
  9. # Set .. _ log_file_size to 25% of buffer pool size
  10. Innodb_log_file_size = 5 M
  11. Innodb_log_buffer_size = 8 M
  12. Innodb_flush_log_at_trx_commit = 1
  13. Innodb_lock_wait_timeout = 50

10.

Commands such as sudo adduser xxx will add an account sudo useradd xxx under the home Directory, but will not add an account in the home directory.

Cd/usr/local/mysql

Chown-R mysql: mysql. (All files belong to the group owner)
11.
Initialize Database

Sudo/usr/local/mysql/scripts/mysql_install_db -- defaults-file =/home/mysql/3306/my. cnf -- user = mysql -- basedir =/usr/local/mysql -- datadir =/home/mysql/3306/data
12.
Start Database

Sudo/usr/local/mysql/bin/mysqld_safe -- defaults-file =/home/mysql/3306/my. cnf -- user = mysql -- basedir =/usr/local/mysql -- datadir =/home/mysql/3306/data &

13.

Change the username and password. Replace NEW_PASSWORD with the password you want to set.
/Usr/local/mysql/bin/mysqladmin-u root password 'your password'

Close the database and run the following command:


/Usr/local/mysql/bin/mysqladmin-u root-p shutdown

14. Create a symbolic link: ln-s/usr/local/mysql/support-files/mysql. server/etc/init. d/mysql



15. start: mysql start... here is a problem: Couldn't find MySQL manager (/usr/bin/mysqlmanager) or server (/usr/bin/mysqld_safe). solution: create a soft connection under/usr/local/mysql/bin/mysqld_safe.
========================================================== ========================================================== ======================================
If this error occurs, The server quit without updating PID file (/var/run/mysqld. pid ).

Use the following methods to solve the problem,

Then create a soft link under/home/mysql/3306 /.

Sudo/etc/my. cnf/home/mysql/3306/

Then in:



Sudo vi/etc/init/mysql

Modify:

Basedir =/usr/local/mysql
Datadir =/home/mysql/3306/data




Restart sudo/etc/init. d/mysql restart.

It is successful.

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.