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