mysql 5.6安装
Posted 半暖
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 5.6安装相关的知识,希望对你有一定的参考价值。
官网下载5.6版本 Linux-Generic版本
mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
1.创建mysql用户组
groupadd mysql
2.创建mysql用户
useradd -g mysql -s /sbin/nologin -d /usr/local/mysql -MN mysql
3.创建目录文件
mkdir /data/mysql/mysql3306/{data,logs,tmp} -p
4.解压软件
tar xvf mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
5.创建链接
ln -s mysql-5.6.46-linux-glibc2.12-x86_64/ mysql
6.授权
chown -R mysql:mysql /data chown -R mysql:mysql /usr/local/mysql-5.6.46-linux-glibc2.12-x86_64
7.编辑/etc/my.cnf文件
[client] port = 3306 [mysql] auto-rehash prompt="\u@\h [\d]>" #pager="less ‐i ‐n ‐S" #tee=/opt/mysql/query.log [mysqld] user = mysql # mysql basedir =/usr/local/mysql/ # /usr/local/mysql/ datadir =/data/mysql/mysql3306/data # /usr/local/mysql/data server_id =1003306 # port =3306 # 3306 pid-file = /data/mysql/mysql3306/data/mysql.pid character-set-server=utf8 default-storage-engine=INNODB autocommit = 1 metadata_locks_hash_instances=64
8.初始化mysql
scripts/mysql_install_db --user=mysql
初始化过程中提示如何设置密码
./bin/mysqladmin -u root password ‘new-password‘ ./bin/mysqladmin -u root -h oracle password ‘new-password‘
9.启动mysql
bin/mysqld_safe --user=mysql &
官网安装
shell> groupadd mysql shell> useradd -r -g mysql -s /bin/false mysql shell> cd /usr/local shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell> ln -s full-path-to-mysql-VERSION-OS mysql shell> cd mysql shell> scripts/mysql_install_db --user=mysql shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server
以上是关于mysql 5.6安装的主要内容,如果未能解决你的问题,请参考以下文章
CentOS 6.5系统安装编译安装MySQL 5.6详细过程