Manually compile and install Mysql bitsCN.com
Compile and install Mysql:
1. create a data Directory (in the mysql installation directory by default)
1. create a directory/mydata/data
[Note: Any directory created under the mysql data directory will be recognized as a database]
2. create an independent partition/dev/sdaX (based on the actual situation, we recommend that you use LVM Logical Volumes)
3. mount the new partition to/mydata
4. edit automatic mounting upon startup
Vim/etc/fstab
Add rows similar to the following:
Device mount point file system ULTS 0 0
2. create a user: The user who runs Mysql
1. groupadd-g 3306 mysql
2. useradd-u 3306-g mysql-M-s/sbin/nologin mysql
3. Grant mysql users all permissions on the data directory
Chown-R mysql: mysql/mydata
4. decompress and configure Mysql
1. tar mysql-5.5.15-linux2.6-i686.tar.gz-C/usr/local
2. cd/usr/local
3. ln-sv mysql-5.5.15-linux2.6-i686 mysql
4. cd mysql
5. chown-R mysql: mysql.
Initialize Mysql:
6. scripts/mysql_install_db -- user = mysql -- datadir =/mydata/data
7. chown-R root.
5. start the configuration service:
Prepare the startup script:
8. cp support-files/mysql. server/etc/init. d/mysqld
Join service queue
9. chkconfig -- add mysqld
Set automatic start upon startup
10. chkconfig mysqld on
Copy the configuration file:
11. cp support-files/my-large.cnf/etc/my. cnf
12. vim/etc/my. cnf
Add the following content under the [mysqld] field:
Datadir =/mydata/data
Change thread_concurrency = 8 to thread_concurrency = 2.
Start the service:
13. service mysqld start
[Note: if the startup fails, view the file ending with ". err" under "data directory"]
6. prepare the header file, library file, and PATH variable (optional, but mysql-dependent files will be found in the default directory)
# Library files:
Vim/etc/ld. so. conf. d/mysql. conf
Add:/usr/local/mysql/lib --> save and exit
Ldconfig (-v displays execution results)
# Header file:
Ln-sv/usr/local/mysql/include/usr/include/mysql
# PATH
Vim/etc/profile
Add: PATH = $ PATH:/usr/local/mysql/bin (it is recommended to add it to the "export" line)
Source/etc/profile
# MAN (it doesn't matter if you don't want to configure it)
Vim/etc/man. config
Add: MANPATH/usr/local/mysql/man
This article is from the "Wei's Linux bar" blog
BitsCN.com