How to install MySQL 5.5 under Linux:
1, install the required system library related library files
Development kits such as GCC, installed when installing Linux systems.
2. Create MySQL installation directory
# mkdir-p/usr/local/mysql/
3. Create a data storage directory
# mkdir-p/service/data/
4. Create user and user groups and assign data to directory permissions
# Groupadd MySQL
# useradd-g MySQL MySQL
# chown Mysql:mysql-r/service/data/
5, install CMake (mysql5.5 after the cmake to compile)
# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
# tar ZXVF cmake-2.8.4.tar.gz
# CD cmake-2.8.4
#./configure
# Make && make install
The easiest way to do this is to install it with the Yum install CMake, but only if the Yum source is configured, or you can find the CMake RPM package from the system installation disk.
6. Download and unzip MySQL 5.5.15
wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.15.tar.gz
[Email protected] down]# tar zxvf mysql-5.5.15.tar.gz
[Email protected] down]# CD mysql-5.5.15
7. Edit MySQL compilation parameters
CMake. \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/service/data \
-dwith_innobase_storage_engine=1 \
-dwith_myisam_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-DSYSCONFDIR=/ETC \
-dwith_extra_charsets=all \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dmysql_user=mysql \
-dwith_debug=0 \
-denabled_local_infile=1
Source code configuration options Description:
/*************** compilation parameter Comment *************************************************
MySQL installed home directory, 5.5. Version 8 defaults to/usr/local/mysql, so you can not add
-dcmake_install_prefix=/usr/local/mysql
MySQL data save path, custom
-dmysql_datadir=/home/system_username/mysql/mysqldata
MySQL profile address------The default my.cnf option file directory
-dsysconfdir=/etc
Compile storage engine XXX statically into server
/*storage engines is built as plugins. You can build a plugin as a static module (compiled into the server)
*or a dynamic module (built as a dynamic library that must is installed into the server using the INSTALL
*plugin statement or the--plugin-load option before it can be used). Some plugins might not support static
*or Dynamic Building.
*/
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_federated_storage_engine=1
-dwith_partition_storage_engine=1
Unix Socket File
/**the Unix socket file path on which the server listens for socket connections. This must is an absolute path *name. The default Is/tmp/mysql.sock
*/
-dmysql_unix_addr=/tmp/mysqld.sock
Listening port for the database server TCP/IP connection, default is 3306
-dmysql_tcp_port=3306
Whether to enable LOCAL capability in the client library for LOAD DATA INFILE
Default is OFF, this opens
-denabled_local_infile=1
/Database Encoding settings
-dwith_extra_charsets=all
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
end***************************/
8. Make && make install
9. Initialize the database and modify the default password
CP support-files/my-huge.cnf/etc/my.cnf
Memory in 1g-2g choose my-huge.cnf better.
Vi/etc/my.cnf
can be added under [mysqld] as needed:
Interactive_timeout = 100wait_timeout = 100# The above two parameters are set to take effect max_connections = 1500max_connect_errors = 1500default-storage-engine = MyISAM
To create a startup script:
CP Support-files/mysql.server/etc/init.d/mysqld
chmod 755/etc/init.d/mysqld
initialize MySQL and generate an authorization library:
Bash scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/service/data/
start MySQL:
/etc/init.d/mysqld start
log in to MySQL:
/usr/local/mysql/bin/mysql-u root-p
Change Password:
Mysql>use MySQL;
Mysql>update User Set Password=password ("12345") where user= ' root ';
Mysql>flush privileges;
MySQL can also be added to the startup item and set as a service startup:
Chkconfig--add mysqld
Chkconfig--level 345 mysqld on
Service mysqld Restart
Attention:
The tar package after MySQL 5.5 is installed with CMake instead of the previous autotools (configure mode)
Tags: mysql database mysql5.5
Related logs:
Build nginx+php (FastCGI) +mysql operating environment under Linux
Using the shell to manipulate the MySQL database
Using mobile phone message to monitor MySQL database's running and strong state
RPM always prompts specifies multiple when deleting an installation package packages
Solution to prompt character encoding error when initializing MySQL database
Bulk replace a specified string in a MySQL database
About the character set problem with MySQL
Install MySQL database under Linux system