Download MySQL Source package
Unzip to the/usr/local directory tar XF mysql-5.5.28.tar.gz-c/usr/local
Cd/usr/local
LN-SV mysql-5.5.28 MySQL
Cd/mysql
Groupadd-r-G 306 MySQL is more than 500 is not a system user
Useradd-g 306-r-U 306 mysql
Chown-r mysql.mysql/usr/local/src/mysql-5.5.4-m3-linux2.6-x86_64
Chown-r Mysql.mysql/usr/local/mysql
Chown-r mysql.mysql/usr/local/mysql/*
chmod +w/usr/local/mysql
Init script under scrips in MySQL directory
The initialization result is saved in the data directory by default.
Create a logical Volume FDISK/DEV/SDA
N
4
+20g
T
8e
W
Partprobe/dev/sda
To create a physical volume: pvcreate/dev/sda4
Create a volume group: vggreate MYVG/DEV/SDA4
Lvcreate-n mydata-l 5G MYVG
Lvs
Mke2fs-j/dev/myvg/mydata
Mkdir/mydata
Vim/etc/fstab
/dev/myvg/mydata/mydata ext3 defaults 0 0
Mount-a && Mount
Mkdir/mydata/data Data Catalog
Chown-r mysql.mysql/mydata/data/
chmod o-rx/mydata/data/Other users cannot have write permission
Execute initialization script, stand in/usr/local/mysql directory
scripts/mysql_install_db--user=mysql--datadir=/mydata/data
Chown-r root/usr/local/mysql/* Change Number master back to root user
Because we've already done LVM to change the storage location of the data file, so MySQL's data owner doesn't have to be MySQL.
Mysql.server startup script in Support-file directory
CP Support-files/mysql.server/etc/init.d/mysqld
Chkconfig--add mysqld Add into service
MySQL does not have a configuration file at this time
Find/ETC/MY.CNF first.
I can't find/etc/mysql/my.cnf.
Can't find/$BASEDIR/my.cnf
We're in support. Head MY-HUGE.CNF Find a configuration file that fits your memory
CP Support-files/my-lar GE.CNF/ETC/MY.CNF
Also to be modified
in [mysqld]
--port Port
--socket When you install MySQL in a different way, make sure that the MYSQL.SOC path is
--thread_concurrency = 8 thread concurrency, up to how many MySQL threads are started, one thread takes up a CPU, typically the number of CPUs is multiplied by 2 (Cat/proc/cpuinfo see the number of CPUs)
* * Add a row * * DataDir =/mydata/data Specifies the data directory, if you do not do LVM do not add; it's all my trouble.
Start: Service mysqld start
vim/etc/profile.d/mysql.sh export path= $PATH:/usr/local/mysql/bin Restart
##########################################################
MySQL server maintains two types of variables
Server variables
Defining MySQL Server Run characteristics
Show global variables
State variables
Save statistics on MySQL server runtime
Show global status
MySQL wildcard characters:
_: Any single character
%: Any character of any length
##############################
Display the version number of the database:
Select version ();
Displays the current default database
Select Database ();
View the currently logged on user
Select User ();
To view the run state variables that contain select
Select Global status like '%select% '
################ #33 #################################
Tuning MySQL is the tune:
Show global variables [like ' String ']
See if performance improves after tuning
Show global status [like ' String ']
###################################################
Create a library file
Vim/etc/ld.so.conf.d/mysql.conf
Fill in:/usr/local/mysql/lib
Ldconfig-v re-reading library files
Output header File
Cd/usr/local/mysql
Ln-sv/usr/local/mysql/include/usr/include/mysql
compiling MySQL manually