1,进入源码所在目录:cd mysql-5.5.2-m2/
2,./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg
3,make & make install
4,cp -r /usr/local/mysql/share/mysql /usr/share
5,cd /mysql/3306,编辑my.cnf
[client] #password = your_password port = 3306 socket = /mysql/3306/mysql.sock # Here follows entries for some specific programs [mysqld_safe] datadir = /mysql/3306/data log-error = /mysql/3306/mysql_error.log pid-file = /mysql/3306/mysql.pid socket = /mysql/3306/mysql.sock [mysqld] port = 3306 socket = /mysql/3306/mysql.sock
6,cd /usr/local/mysql/bin
7,初始化数据库:./mysql_install_db --datadir=/mysql/3306/data --user=mysql --basedir=/usr/local/mysql
所有的数据放在/mysql/3306/data目录下
8,开启mysqld守护进程:./mysqld_safe --defaults-extra-file=/mysql/3306/my.cnf --user=mysql &
9,启动mysql命令行,进行数据库操作:./mysql -S /mysql/3306/mysql.sock -P 3306
10,终止mysqld守护进程:./mysqladmin -u root -S /mysql/3306/mysql.sock shutdown