首页 > 代码库 > 阿里云服务器手动安装mysql

阿里云服务器手动安装mysql

    最近一年阿里云的服务器非常火,有幸接触了一下,下面介绍全新阿里云linux(CentOS6.5)编码方式手动安装Mysql5.6的全过程:


一、登录服务器

首先安装几个我个人常用的软件

# yum -y install lrzsz nmap telnet


二、上传并解压安装包

# cd /usr/local/src

# rz   /使用rz命令上传要安装的包(mysql-5.6.10.tar.gz)到服务器上;

# tar xzvf mysql-5.6.10.tar.gz


三、安装Mysql

# cd mysql-5.6.10

# vim compile.sh    //内容如下:

#!/bin/bash
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_DEBUG=0


# yum -y install cmake ncurses-devel    //必须安装这两个程序包,否则执行上面的脚本文件会报错;

# chmod 755 compile.sh

# ./comple.sh

# make

# make install

# useradd -M mysql

# chown -R mysql.mysql /usr/local/mysql

# mv /etc/my.cnf /etc/my.cnf.bak

# cd /usr/local/mysql/support-files

# cp my-default.cnf /etc/my.cnf

# cp mysql.server /etc/rc.d/init.d/mysqld

# chkconfig --add mysqld

# chkconfig mysqld on

# cd /usr/local/mysql/scripts/

# mkdir -p /data/var/lib/mysql

# vim /etc/my.cnf    //添加如下内容

[client]
default-character-set=utf8
socket=/data/var/lib/mysql/mysql.sock
[mysql]
default-character-set=utf8  
socket=/data/var/lib/mysql/mysql.sock
[mysqld]
skip-host-cache
skip-name-resolve
default-storage-engine=INNODB
socket=/data/var/lib/mysql/mysql.sock
datadir=/data/var/lib/mysql
max_connections=1000
back_log=500
innodb_buffer_pool_size=256M
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=20M
innodb_additional_mem_pool_size=20M
thread_cache_size=16
interactive_timeout=300
wait_timeout=300


# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/var/lib/mysql

# /etc/init.d/mysqld start

# vim /root/.bash_profile    //在文件最后增加如下内容:

export mysql=/usr/local/mysql
export PATH=$mysql/bin:$PATH


# msyql    //登录mysql,删除多余的用户,只保留host=localhost,uesr=root的一个用户;并且设置root的登录密码等;



本文出自 “方寸小山” 博客,请务必保留此出处http://63638790.blog.51cto.com/513514/1592697

阿里云服务器手动安装mysql