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 &
10.修改密码
set password for 'root'@'localhost'=password('234567');
官网安装
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