第一:安装 客户端
rpm -ivh MySQL-devel-5.5.10-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-client-5.5.10-1.linux2.6.x86_64.rpm
第二:建立mysql用户和数据日志目录
useradd -M -s /sbin/nogin mysql
mkdir /data/log/ -p
chown mysql:mysql /data/ -R
第三:安装mysql
tar zxvf cmake-2.8.4.tar.gz -C /usr/src/
cd /usr/src/cmake-2.8.4/
./configure
make && make install
cd ../
tar zxvf mysql-5.5.10.tar.gz -C /usr/src/
cd /usr/src/mysql-5.5.10
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DMYSQL_DATADIR=/data/ -DMYSQL_UNIX_ADDR=/data/mysqld.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DCMAKE_THREAD_PREFER_PTHREAD=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0
make && make install
第四:创建my.cnf配置文件(看my.cnf配置)
第五:修改服务启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/ --defaults-file=/etc/my.cnf
/sbin/service mysqld start
echo 'export PATH=$PATH:$'mysql_dir'/bin' >> /etc/profile
mysql -u root -S /data/mysql.sock 无密码登入
第六 :修改root默认密码
$mysql_dir/bin/mysql -e "grant all privileges on *.* to root@'%' identified by '123' with grant option;"
$mysql_dir/bin/mysql -e "flush privileges;"
$mysql_dir/bin/mysql -e "delete from mysql.user where password='';"
source /etc/profile
/sbin/service mysqld restart
=============================
aptitude install make cmake gcc g++ bison libncurses5-dev zlib
CFLAGS="-O3 -g -fno-exceptions -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing"
CXX=g++
CXXFLAGS="-O3 -g -fno-exceptions -fno-rtti -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing"
export CFLAGS CXX CXXFLAGS
cmake . \
-DSYSCONFDIR:PATH=/var/lib/mysql/ \
-DCMAKE_INSTALL_PREFIX:PATH=/var/lib/mysql/ \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DENABLE_PROFILING:BOOL=ON \
-DWITH_DEBUG:BOOL=OFF \
-DWITH_VALGRIND:BOOL=OFF \
-DENABLE_DEBUG_SYNC:BOOL=OFF \
-DWITH_EXTRA_CHARSETS:STRING=all \
-DWITH_SSL:STRING=bundled \
-DWITH_UNIT_TESTS:BOOL=OFF \
-DWITH_ZLIB:STRING=bundled \
-DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \
-DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
-DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=ON \
-DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON \
-DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE:BOOL=ON \
-DWITH_EMBEDDED_SERVER=0 \
-DINSTALL_LAYOUT:STRING=STANDALONE \
-DCOMMUNITY_BUILD:BOOL=ON \
-DMYSQL_SERVER_SUFFIX='-r5436';
make && make install
阅读(2028) | 评论(0) | 转发(0) |