文件名:
mysql-5.5.32-linux2.6-x86_64.tar.gz
#cp mysql-5.5.32-linux2.6-x86_64.tar.gz /usr/local/src
#mv mysql-5.5.32-linux2.6-x86_64.tar.gz mysql-5.5.32-bin
#mv mysql-5.5.32-bin /usr/local/
初始化数据库:
#useradd mysql -s /sbin/nologin -M
#chown mysql.mysql -R /usr/local/mysql-5.5.32-bin
#cd mysql-5.5.32-bin/scripts/
#mysql_install_db --user=mysql--basedir=/usr/local/mysql-5.5.32-bin/--datadir=/usr/local/mysql-5.5.32-bin/data/
#cp support-files/mysql.server /etc/init.d/mysqldbin
#chmod 755 /etc/init.d/mysqldbin
vim /etc/init.d/mysqlbin
# If you change base dir, you must also change datadir.These may get
# overwritten by settings in the MySQL configurationfiles.
#添加基目录和数据目录
basedir=/usr/local/mysql-5.5.32-bin
datadir=/usr/local/mysql-5.5.32-bin/data
# Default value, in seconds, afterwhich the script shouldtimeout waiting
# for server start.
# Value here is overriden by value in my.cnf.
#cp support-files/my-medium.cnf /etc/my.cnf #这步不是必需的
启动数据库:
[root@node1 bin]# /etc/init.d/mysqldbin start
Starting MySQL SUCCESS!
[root@node1 bin]# ps -ef | grep mysqld
root 2664 2033 009:17 pts/0 00:00:00 vim/etc/init.d/mysqldbin
root 2842 1 009:21 pts/0 00:00:00 /bin/sh/usr/local/mysql-5.5.32-bin/bin/mysqld_safe --datadir=/usr/local/mysql-5.5.32-bin/data--pid-file=/usr/local/mysql-5.5.32-bin/data/node1.pid
mysql 2945 2842 009:21 pts/0 00:00:00/usr/local/mysql-5.5.32-bin/bin/mysqld --basedir=/usr/local/mysql-5.5.32-bin--datadir=/usr/local/mysql-5.5.32-bin/data --plugin-dir=/usr/local/mysql-5.5.32-bin/lib/plugin--user=mysql --log-error=/usr/local/mysql-5.5.32-bin/data/node1.err--pid-file=/usr/local/mysql-5.5.32-bin/data/node1.pid
root 2978 2033 009:28 pts/0 00:00:00 vim/etc/init.d/mysqldbin
root 3068 2033 009:29 pts/0 00:00:00 grep --color=automysqld
[root@node1 bin]# netstat -antup | grep mysqld
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2945/mysqld
[root@node1 bin]# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODENAME
mysqld 2945mysql 10u IPv4 20388 0t0 TCP *:mysql (LISTEN)