Mysql安装
1.安装相关包
1.1安装cmake软件
cd /root/tools tar xf cmake-2.8.8.tar.gz cd cmake-2.8.8 ./configure gmake gmake install cd ..
1.2安装依赖包
yum install ncurses-devel –y
2.安装mysql
groupadd mysql useradd -s /sbin/nologin -M -g mysql mysql
tar xf mysql-5.5.32.tar.gz cd mysql-5.5.32 cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 -DMYSQL_DATADIR=/application/mysql-5.5.32/data -DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
make && make install ln -s /application/mysql-5.5.32/ /application/mysql cp /root/tools/mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf echo ‘export PATH=/application/mysql/bin/:$PATH‘ >>/etc/profile tail -l /etc/profile source /etc/profile echo $PATH chown -R mysql.mysql /application/mysql/data/ cd /application/mysql/scripts/ ./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql cp /root/tools/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld /etc/init.d/mysqld start netstat -tulnp |grep 3306 chkconfig mysqld on chkconfig --list |grep mysqld
3.简单优化
mysql select user,host from mysql.user; delete from mysql.user where user=‘‘; delete from mysql.user where host="localhost.localdomain"; delete from mysql.user where host="::1"; drop database test; show databases; quit mysqladmin -uroot password
原文地址:http://jcat2008.blog.51cto.com/320366/1746461