码迷,mamicode.com
首页 > 数据库 > 详细

mysql 5.6安装

时间:2019-11-02 22:23:07      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:软件   default   _id   过程   amp   page   server   --   auto   

官网下载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安装

标签:软件   default   _id   过程   amp   page   server   --   auto   

原文地址:https://www.cnblogs.com/hanglinux/p/11784075.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!