1.install

#!/bin/bash
/mysql/bin/mysql_install_db –user=service –basedir=/mysql/ –datadir=/mysql_data/

2.init

#!/bin/bash
nohup /mysql/bin/mysqld –datadir=/mysql_data –basedir=/mysql/ –log-error=/var/logs/mysql/mysqld.log –pid-file=/var/logs/mysql/mysqld.pid > /var/logs/mysql/start.log 2>&1 &
#免密模式
#nohup /home/service/app/mysql/bin/mysqld -nt –skip-grant-tables –datadir=/home/service/var/data/mysql_data –basedir=/home/service/app/mysql/ –log-error=/var/logs/mysql/mysqld.log –pid-file=/var/logs/mysql/mysqld.pid > /var/logs/mysql/start.log 2>&1 &

3.grant

先免密模式下

update user set authentication_string=password(‘密码’),password_expired=”N” where user=’root’;

再正常模式下

grant all on *.* to ‘root’@’%’ identified by ‘密码’;

最后

flush privileges;