1、设置GCC编译参数
CHOST="i686-pc-linux-gnu"
CFLAGS="-O3 -msse2 -mmmx -Wall -W -mfpmath=sse -mcpu=pentium-m -march=pentium-m -pipe -fomit-frame-pointer"
CXXFLAGS="-O3 -msse2 -mmmx -Wall -W -mfpmath=sse -funroll-loops -mcpu=pentium-m -march=pentium-m -pipe -fomit-frame-pointer"
2、修改mysql 客户端最大连接数
vi sql/mysqld.cc
搜索找到下面一行:
{"max_connections", OPT_MAX_CONNECTIONS,
"The number of simultaneous clients allowed.", (gptr*) &max_connections,
(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1,
0},
将其中的100改为1500, 当然小点也可以,根据你的需要来,不建议改的太大。
{"max_connections", OPT_MAX_CONNECTIONS,
"The number of simultaneous clients allowed.", (gptr*) &max_connections,
(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 1500, 1, 16384, 0, 1,
0},
保存
3、安装Mysql
# ./configure --prefix=/usr/local/mysql \
--localstatedir=/var/lib/mysql \
--with-comment=Source \
--with-server-suffix=-enterprise-gpl \
--with-mysqld-user=mysql \
--without-debug \
--with-big-tables \
--with-charset=gbk \
--with-collation=gbk_chinese_ci \
--with-extra-charsets=all \
--with-pthread \
--enable-static \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-assembler \
--without-innodb \
--without-ndb-debug \
--without-isam \
--enable-local-infile \
--with-readline \
--with-raid
# make && make install
# groupadd mysql
# useradd -g mysql -d /dev/null -s /sbin/nologin mysql
# adduser -g mysql -d /dev/null -s /sbin/nologin mysql
# cd /usr/local/mysql/
# bin/mysql_install_db --user=mysql
# chown -R root:mysql .
# chown -R mysql:mysql /var/lib/mysql
# cd share/mysql
# cp my-medium.cnf /etc/my.cnf
# cp mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
4、添加LIB PATH
# echo "/usr/local/mysql/lib" >> /etc/ld.so.conf && ldconfig
5、启动Mysql
# /etc/rc.d/init.d/mysqld start
或者
# service mysqld start
6、设置Mysql的root密码
bin/mysqladmin -u root password 123456
修改root密码
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD(’new_password’) WHERE user=’root’;
mysql> FLUSH PRIVILEGES;
7、设置root远程登录
# mysql -u root -p 123456
mysql> GRANT ALL PRIVILEGES ON *.* TO root@'%' identified by '123456' ;
8、关闭Mysql
# /etc/rc.d/init.d/mysqld stop
或者
# service mysqld stop
9、设置中文字符集
vi /etc/my.cnf
在[client]下面增加一行:
[client]
default-character-set = gbk
在[mysqld]下面增加三行:
[mysqld]
default-character-set = gbk
default-collation = gbk_chinese_ci
init_connect = 'SET NAMES gbk'
在[mysql]下面增加一行:
[mysql]
default-character-set = gbk