mysql 5.7.15 安装_MySQL 5.7.15 安装 (二进制版本)

0.创建mysql用户和组信息[root@gxoradb1 ~]# groupadd mysql

[root@gxoradb1 ~]# useradd -r -g mysql -s /bin/false mysql1.指定安装目录[root@gxoradb1 ~]# cd /usr/local

[root@gxoradb1 local]# ls

mysql-advanced-5.7.15-linux-glibc2.5-x86_64.tar.gz2.解压mysql[root@gxoradb1 local]# tar -zxvf mysql-advanced-5.7.15-linux-glibc2.5-x86_64.tar.gz

[root@gxoradb1 local]# mv mysql-advanced-5.7.15-linux-glibc2.5-x86_64/ mysql-5.7.15

[root@gxoradb1 local]# ln -s mysql-5.7.15 mysql

[root@gxoradb1 local]# ls -la

lrwxrwxrwx  1 root root     12 Oct  4 14:58 mysql -> mysql-5.7.15

drwxr-xr-x  9 root root   4096 Oct  4 14:56 mysql-5.7.153.调整目录权限[root@gxoradb1 local]# cd mysql

[root@gxoradb1 mysql]# mkdir mysql-files[root@gxoradb1 mysql]# chmod 750 mysql-files

[root@gxoradb1 mysql]# chown -R mysql:mysql .The mysql-files directory provides a convenient location to use as the value of the secure_file_priv system variable that limits import/export operations to a specific directory.4.初始化mysql[root@gxoradb1 mysql]# bin/mysqld --initialize --user=mysql2016-10-04T07:07:05.044029Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2016-10-04T07:07:05.351321Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-10-04T07:07:05.396915Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-10-04T07:07:05.454329Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 2825c52a-8a01-11e6-abb2-080027b5eb23.

2016-10-04T07:07:05.456104Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2016-10-04T07:07:06.265334Z 0 [Warning] CA certificate ca.pem is self signed.

2016-10-04T07:07:06.503976Z 1 [Note] A temporary password is generated for root@localhost: <5Tk+Gs7frb7 //临时口令[root@gxoradb1 mysql]# bin/mysql_ssl_rsa_setup5.调整目录权限[root@gxoradb1 mysql]# chown -R root .

[root@gxoradb1 mysql]# chown -R mysql data mysql-files6.启动mysql[root@gxoradb1 mysql]# bin/mysqld_safe --user=mysql &

[1] 11211

[root@gxoradb1 mysql]# 2016-10-04T07:10:20.032700Z mysqld_safe Logging to '/usr/local/mysql/data/gxoradb1.err'.

2016-10-04T07:10:20.058270Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data7.创建自启动脚本[root@gxoradb1 mysql]# cp support-files/mysql.server /etc/init.d/mysql.server

[root@gxoradb1 mysql]# chkconfig --add mysql.server

[root@gxoradb1 mysql]# chkconfig --list mysql.server

mysql.server    0:off   1:off   2:on    3:on    4:on    5:on    6:off8.登录mysql数据库[root@gxoradb1 ~]# mysql -u root -h localhost -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.7.15-enterprise-commercial-advanced

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.9.修改root用户口令mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'oracle';mysql> set password for 'root'@'localhost'=password('oracle');

官方文档中对二进制安装的说明shell> yum install libaio //安装libaio包shell> groupadd mysqlshell> useradd -r -g mysql -s /bin/false mysqlshell> cd /usr/localshell> tar zxvf /path/to/mysql-VERSION-OS.tar.gzshell> ln -s full-path-to-mysql-VERSION-OS mysqlshell> cd mysqlshell> mkdir mysql-filesshell> chmod 750 mysql-filesshell> chown -R mysql .shell> chgrp -R mysql .shell> bin/mysql_install_db --user=mysql    # Before MySQL 5.7.6

shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up

shell> bin/mysql_ssl_rsa_setup              # MySQL 5.7.6 and up

shell> chown -R root .shell> chown -R mysql data mysql-filesshell> bin/mysqld_safe --user=mysql  Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.serverDirectoryContents of Directorybin,scriptsmysqld server, client and utility programs

dataLog files, databases

docsMySQL manual in Info format

manUnix manual pages

includeInclude (header) files

libLibraries

shareMiscellaneous support files, including error messages, sample configuration files, SQL for database installation

解压:将下载的zip包解压到你想要放置的位置,我的是:E:\study\mysql-5.7.15-winx64 新建配置文件my.ini:在E:\study\mysql-5.7.15-winx64路径下有一个my-default.ini文件,该文件是mysql默认的配置文件。我们可以复制一份,并改名为my.ini。打开该文件,在里面添加:skip-grant-tables( 用于跳过密码认证) 安装mysql: 以管理员权限打开cmd,然后进入E:\study\mysql-5.7.15-winx64\bin文件夹输入以下命令:mysqld --initialize (用于初始化mysqlMySQL会帮你自动进行初始化,例如生成data文件夹) 再输入:mysqld install(安装mysql)若安装成功,会提示Service successfully installed 安全模式打开:输入命令:mysqld --skip-grant-tables(跳过认证表),此时光标会跳到下一行一直闪烁。 新窗口启动服务:同样以管理员权限进入bin文件夹,输入命令:mysql -u root -p会提示输入密码,直接回车可以进入。此时就可以成功进入数据库了。 修改密码:输入use mysql;然后更改密码: update user set password=password("123456") where user="root";//旧版本 update user set authentication_string=password("123456") where user="root";//新版本 最后flush privileges;就可以了 重新使用密码登录:先在my.ini配置删除skip-grant-tables,然后在bin文件夹下输入net start mysql(若提示无法启动可能是刚刚的mysql还没有结束,可以打开任务管理器把mysqld.exe关闭),接着输入mysql -u root -p回车,然后输入你刚刚的密码,这里是:123456。可以看到成功登录进去。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值