1.下载mysql 二进制文件 mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz 可以根据自己的需求下载不同版本的mysql 现在以5.6最新版本的安装为例
tar -zxvf mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
useradd mysql
mv mysql-5.6.26-linux-glibc2.5-x86_64 /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql
cd /usr/local/mysql/script
二.初始化数据库
./mysql_install_db --datadir=/usr/local/mysql/data/ --basedir=/usr/local/mysql --user=mysql
三.配置mysql my.cnf (具体的优化在后续的博文中给出)
[mysqld]
innodb_buffer_pool_size = 128M
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
server_id = 2
expire_logs_days=3
character-set-server = utf8
default-storage-engine=innodb
user = mysql
log_bin=/usr/local/mysql/data/mysqlbinlog
max_binlog_size=100M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
四、变更环境变量
export PATH=/usr/local/mysql/bin:$PATH (先进行测试,再去修改 /etc/profile以免影响其它用户)
五、起动脚本
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod a+x /etc/init.d/mysqld
server mysqld start #这样就可以启动mysql了
ss -naptl|grep mysql #查看进程是否正常启动成功
阅读(909) | 评论(0) | 转发(0) |