Compiling and installing MySQL-5.5
Search Download http://down.51cto.com/
Prepare to compile before installing MySQL
Install the tools and libraries needed to compile the source code
"Pure CentOS 6.6 i386"
Yum install gcc gcc-c++ ncurses-devel perl wget readline-devel zlib-devel Openssl-dev cmake
"CMAKE"
Specifies the options that are commonly used when installing the installation path of a file:
-dcmake_install_prefix=/usr/local/mysql
-dmysql_datadir=/data/mysql
-dsysconfdir=/etc
The storage engines that are compiled by default include: CSV, MyISAM, MYISAMMRG, and heap. To install additional storage engines, you can use a compilation option similar to the following:
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_federated_storage_engine=1
To explicitly specify that a storage engine is not compiled, you can use an option similar to the following:
-dwithout_<engine>_storage_engine=1
Like what:
-dwithout_example_storage_engine=1
-dwithout_federated_storage_engine=1
-dwithout_partition_storage_engine=1
If you want to compile into other functions, such as SSL, you can use a library similar to the following, or do not use a library when compiling:
-dwith_readline=1
-dwith_ssl=system
-dwith_zlib=system
-dwith_libwrap=0
Other common options:
-dmysql_tcp_port=3306
-dmysql_unix_addr=/tmp/mysql.sock
-denabled_local_infile=1
-dextra_charsets=all
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_debug=0
-denable_profiling=1
If you want to clean up the files generated by the previous compilation, you need to use the following command:
Make clean
RM CMakeCache.txt
2. Compile and install MySQL
# tar xf mysql-5.5.33.tar.gz # cd mysql-5.5.33# cmake . -dcmake_ Install_prefix=/usr/local/mysql -dmysql_datadir=/mydata/data/ -dsysconfdir=/etc -dwith_innobase _storage_engine=1 -dwith_archive_stprage_engine=1 -dwith_blackhole_storage_engine=1 -dwiyh_ readline=1 -dwiyh_ssl=system -dvith_zlib=system -dwith_lobwrap=0 -dmysql_unix_addr=/tmp/ Mysql.sock -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci# make # make install# groupadd -r -g 306 mysql# useradd -g mysql -u 306 -r -s /sbin/nologin mysql Initialize mysql# cd /usr/local/mysql/[[email Protected] mysql]# mkdir -pv /mydata/data[[email protected] mysql]# chown :mysql -r ./*[[email protected] mysql]# chown -r mysql.mysql / Mydata/data/[[email protecTed] mysql]# ll /mydata/data/ -d[[email protected] mysql]# scripts/mysql_ install_db --user=mysql --datadir=/mydata/data/[[email protected] mysql]# cp Support-files/mysql.server /etc/rc.d/init.d/mysqld[[email protected] mysql]# chmod +x /etc/rc.d/init.d/mysqld[[email protected] mysql]# chkconfig --add mysqld[[email protected] mysql]# cp support-files/my-large.cnf /etc/my.cnf[[email protected] mysql]# vim /etc/my.cnf +40datadir= /mydata/data Data Catalog Thread_concurrency = 4 set the number of threads (core number x2) into the save. vim /etc/profile.d/mysql.shexport path=/usr/local/mysql/bin: $PATH [[email protected] ~]# service mysqld restart[[email protected] mysql]# netstat -tnlp
Initialize MySQL
Open a new shell, enable Mysql[[email protected] ~]# mysqlmysql> use mysql;mysql> SELECT User,host,password from User;1, Delete anonymous users mysql> drop user ' @ ' localhost.localdomain ';mysql> drop user ' @ ' localhost '; 2. Set the password for all root users: The first way: MySQL > Set PASSWORD for [email protected] = PASSWORD (' Your_passwrod '); the second way:mysql> UPDATE user SET PASSWORD = PASSWORD (' Y Our_password ') WHERE user = ' root ';mysql> FLUSH privileges; Third Way: # mysqladmin-uusername-hhost password ' new_password '-p# mysqladmin-uusername-hhost-p flush-privileges
This article comes from "Life is endless, tossing and turning." "Blog, be sure to keep this provenance http://990487026.blog.51cto.com/10133282/1692874
Linux CentOS6.6 i386 source CMake compile MySQL 5.5