切换到mysqladmin用户
[root@hadoop001 ~]# su - mysqladmin
[mysqladmin@hadoop001 ~]$ pwd
/usr/local/mysql
#创建binlog日志存储的文件夹
[mysqladmin@hadoop001 ~]$ mkdir arch
[mysqladmin@hadoop001 ~]$scripts/mysql_install_db --user=mysqladmin --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
#复制相应的文件到系统目录
[root@hadoop001 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysql
[root@hadoop001 mysql]# chmod +x /etc/rc.d/init.d/mysql
[root@hadoop001 mysql]# chkconfig --del mysql
[root@hadoop001 mysql]# chkconfig --add mysql
[root@hadoop001 mysql]# chkconfig --level 345 mysql on
在开机文件中写入开机启动mysql
[mysqladmin@hadoop001 ~]$ cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - mysqladmin -c "/etc/inid./mysql start"
[mysqladmin@hadoop001 ~]$ service mysql start
[mysqladmin@hadoop001 ~]$ ps aux|grep mysql
root 10770 0.0 0.1 145340 1616 pts/1 S 06:17 0:00 su - mysqladmin
514 11705 0.0 0.1 106184 1536 pts/1 S 06:27 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/hostname.pid
514 12386 0.3 26.7 2103188 269140 pts/1 Sl 06:27 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/hostname.err --pid-file=/usr/local/mysql/data/hostname.pid --socket=/usr/local/mysql/data/mysql.sock --port=3306
514 12414 0.0 0.0 103240 876 pts/1 S+ 06:28 0:00 grep mysql
出现如下界面表示进入数据库成功
[mysqladmin@hadoop001 ~]$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>