只需三步
第一步,下载并解压
下载:http://www.mysql.com/downloads/
解压:tar xvf mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar
第二步,执行安装脚本
进入到解压的mysql目录,执行如下命令
./scripts/mysql_install_db --user=root
第三步,启动mysql
./bin/mysqld_safe --user=root &
Bonus
设置mysql中root用户密码
mysqladmin -u root password 新密码
注册为service
复制启动脚本到init.d
cp support-files/mysql.server /etc/init.d/mysql
注:因为是以root用户启动mysql的,所以再启动mysqld_safe进程时必须有--user=root
参数,但mysql.server并没有此参数,因此需要修改下mysql.server脚本:
编辑mysql.server,在283行添加参数
...
$bindir/mysqld_safe --user=root --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
...
之后就可以使用service mysql start
等命令来启动mysql服务了。
设置开机启动
chkconfig mysql on