<pre name="code" class="sql">1.安装vsftp
v-lhb-db03:/root# yum install vsftpd-2.2.2-13.el6_6.1.x86_64
Loaded plugins: fastestmirror, security
Determining fastest mirrors
2.注:请自行配置好yum源,不过centos默认的在线yum源也挺好用
# yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses* libmcrypt* libtool-ltdl-devel* make cmake --必要软件包安装
rpm -qa gcc
gcc-c++
gcc-g77
autoconf
automake
zlib*
fiex*
libxml*
ncurses*
libmcrypt*
libtool-ltdl-devel*
make
cmake
3.创建用户安装mysql
#groupadd mysql
# useradd -m -g mysql -s /sbin/nologin mysql
# tar -zxvf mysql-5.6.10.tar.gz
# cd mysql-5.6.10
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql --设置安装路径
.
# make && make install --编译安装
# chown -R mysql:mysql /usr/local/mysql --设置目录权限
#mkdir -p /data01/mysql/
#chown -R mysql:mysql /data01/mysql/
#mkdir -p /var/log/mysql/
#chown -R mysql:mysql /var/log/mysql
# mkdir -p /var/run/mysqld
# chown -R mysql:mysql /var/run/mysqld
# --basedir=/usr/local/mysql --datadir=/data01/mysql
# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data01/mysql/ --安装db
4.--以下为设置开机自启及启动服务
# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql
# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
# chkconfig --add mysql && chkconfig mysql on
4.创建binlog 目录
v-lhb-db03:/root# mkdir -p /data01/mysqllog/binlog/
chown -R mysql:mysql /data01/mysqllog
5.配置my.cnf文件:
[mysqld]
basedir=/usr/local/mysql
datadir=/data01/mysql
socket=/data01/mysql/mysql.sock
user=mysql
slow_query_log=ON
long_query_time=2
server-id=135
log-bin=/data01/mysqllog/binlog/mysql-bin
binlog_format=MIXED
max_binlog_size = 512M
binlog_cache_size = 128K
character-set-server=utf8
default-storage-engine=INNODB
innodb_file_per_table=1
symbolic-links=0
max_connections=1024
[mysqld_safe]
log-error=/var/log/mysql/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
6..启动mysql
v-lhb-db01:/etc# /etc/init.d/mysql start
Starting MySQL.The server quit without updating PID file (/data01/mysql/v-lhb-db01.pid).[FAILED]
v-lhb-db01:/data01/mysql# mysqladmin -uroot password '123123'
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (40)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
# ln -s /data01/mysql/mysql.sock /tmp/mysql.sock
5.修改密码
mysqladmin -uroot password '1234567'
6.[mysql@master ~]$ mysql_secure_installation 初始化
常见错误:
test:/root# /etc/init.d/mysql start
Starting MySQL.The server quit without updating PID file (/[FAILED]ysql/test.pid).
test:/etc/init.d# /usr/local/mysql/bin/mysqld_safe
150512 12:17:15 mysqld_safe Logging to '/var/log/mysql/mysqld.log'.
touch: cannot touch `/var/log/mysql/mysqld.log': No such file or directory
chmod: cannot access `/var/log/mysql/mysqld.log': No such file or directory
touch: cannot touch `/var/log/mysql/mysqld.log': No such file or directory
chown: cannot access `/var/log/mysql/mysqld.log': No such file or directory
150512 12:17:15 mysqld_safe Starting mysqld daemon with databases from /data01/mysql
/usr/local/mysql/bin/mysqld_safe: line 129: /var/log/mysql/mysqld.log: No such file or directory
/usr/local/mysql/bin/mysqld_safe: line 166: /var/log/mysql/mysqld.log: No such file or directory
touch: cannot touch `/var/log/mysql/mysqld.log': No such file or directory
chown: cannot access `/var/log/mysql/mysqld.log': No such file or directory
chmod: cannot access `/var/log/mysql/mysqld.log': No such file or directory
150512 12:17:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
/usr/local/mysql/bin/mysqld_safe: line 129: /var/log/mysql/mysqld.log: No such file or directory
test:/etc/init.d# touch /var/log/mysql/mysqld.log
touch: cannot touch `/var/log/mysql/mysqld.log': No such file or directory
test:/etc/init.d# mkdir -p /var/log/mysql/