mysql 5.7安装

合集下载

Ubuntu18.04下安装mysql5.7超详细步骤

Ubuntu18.04下安装mysql5.7超详细步骤

Ubuntu18.04下安装mysql5.7超详细步骤1、⾸先执⾏下⾯三条命令:#安装mysql服务sudo apt-get install mysql-server#安装客户端sudo apt install mysql-client#安装依赖sudo apt install libmysqlclient-dev#检查状态sudo netstat -tap | grep mysql2、设置root密码:mysql5.7安装完成后普通⽤户不能进mysql,原因:root的plugin被修改成了auth_socket,⽤密码登陆的plugin应该是mysql_native_password,直接⽤root权限登录就不⽤密码,修改root密码和登录验证⽅式:2.1、⾸先⽤root权限登陆mysql:在Ubuntu 18.04终端下输⼊以下命令获取最⾼权限root ,并且根据提⽰输⼊你的终端密码su2.2、登陆mysql:mysql2.3、打开数据库名字为"mysql"的数据库:use mysql;2.4、修改mysql的密码:update user set authentication_string=PASSWORD("这写你设置的密码")where user='root';2.5、输⼊:update user set plugin="mysql_native_password";2.6、刷新权限:flush privileges;2.7、退出mysql命令⾏:quit;2.8、重新打开Ubuntu 18.04终端,正常登陆mysql输⼊:mysql -uroot -p3.0、数据库登陆成功,问题解决。

MySQL5.7安装教程(亲测有效)

MySQL5.7安装教程(亲测有效)

MySQL5.7安装教程(亲测有效)跟着狂神学java到了数据库阶段了,⾸先得安装好数据库啊,这⾥⽤的是MySQL压缩包下载:1. 解压2. 把这个包放到⾃⼰的电脑环境⽬录下(我的是D:\Environment)3. 配置环境变量(在path后⾯加上mysql的bin⽬录D:\Environment\mysql-5.7.19\bin)4. 新建mysql配置⽂件 my.ini//⽬录⼀定要换成⾃⼰的[mysqld]basedir=D:\Environment\mysql-5.7.19\datadir=D:\Environment\mysql-5.7.19\data\port=3306skip-grant-tables5. 启动管理员模式下的CMD,运⾏的所有的命令,将路径切换⾄mysql下的bin⽬录cd /d D:\Environment\mysql-5.7.19\bin,然后输⼊mysqld -install安装mysql6. 再输⼊mysqld --initialize-insecure --user=mysql初始化数据⽂件7. 然后再次启动mysql(在命令⾏窗⼝⽤net start mysql启动)然后⽤命令mysql -u root -p进⼊mysql管理界⾯,此时是没有密码的,Enterpassword不⽤输⼊,直接回车进⼊8. 进⼊界⾯后修改root密码(sql语句后⼀定要加分号!)update er set authentication_string=password('123456') where user='root' and Host='localhost';此时mysq账户名为root,密码为123456(可以⾃⼰改别的)最后输⼊flush privileges;刷新权限9. 修改 my.ini ⽂件:删除最后⼀句skip-grant-tables(也可以在前⾯加个#注释)10. 重启mysql即可正常使⽤net stop mysqlnet start mysql11. 连接测试mysql -u root -p回车然后输⼊密码或者直接mysql -u root -p123456(123456是密码,p后⾯不要加空格),如果连接成功说明安装成功。

mysql5.7安装教程

mysql5.7安装教程

一、删除旧版mysql1、查找以前是否装有mysqlrpm -qa|grep -i mysql可以看到mysql的两个包:mysql-4.1.12-3.RHEL4.1mysqlclient10-3.23.58-4.RHEL4.12、删除mysql删除命令:rpm -e --nodeps 包名( rpm -ev mysql-4.1.12-3.RHEL4.1 )3、删除老版本mysql的开发头文件和库rm -fr /usr/lib/mysqlrm -fr /usr/include/mysql注意:卸载后/var/lib/mysql中的数据及/etc/f不会删除,如果确定没用后就手工删除rm -f /etc/frm -fr /var/lib/mysql二、安装mysql 5.71.去mysql官网下载,解压压缩包,改名为mysql copy到/usr/local/ 下2.创建mysql用户:useradd -r -M -s /sbin/nologin mysql3.给mysql目录赋予权限:chown -R mysql.mysql /usr/local/mysqlchgrp -R mysql /usr/local/mysql4.准备工作:1)安装cmakeyum install cmake2)安装libaio和libaio-develyum install libaio*3)变更工作目录cd /usr/local/mysql/4)给mysql命令映射一个链接:(系统默认会查找/usr/bin下的命令,如果这个命令不在这个目录下,当然会找不到命令,我们需要做的就是映射一个链接到/usr/bin目录下,相当于建立一个链接文件)ln -s /usr/local/mysql/bin/mysql /usr/bin5)开放端口:3306首先,用vi打开防火墙配置文件:vi /etc/sysconfig/iptables然后,在iptables文件内容中加入如下内容:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT 最后,保存配置文件后,执行如下命令重启防火墙:service iptables restart5.开始安装:1)执行如下命令:bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/cp -a ./support-files/f /etc/fcp -a ./support-files/mysql.server /etc/init.d/mysqld6.重置root密码:首先启动服务:/etc/init.d/mysqld start利用mysql生成的首个密码登陆:cat /root/.mysql_secret根据密码登陆-->SET PASSWORD = PASSWORD('ceb_mall');-->flush privileges;重新登录,使用新密码。

MYSQL5.7详细安装步骤

MYSQL5.7详细安装步骤

MYSQL5.7详细安装步骤0、更换yum源1、打开 ,选择centos的系统,点击帮助2、执⾏命令:yum install wget -y3、改变某些⽂件的名称mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup4、执⾏更换yum源的命令wget -O /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-6.repo5、更新本地缓存yum clean allyum makecacheyum list installed | grep mysqlyum -y remove mysql-libs.x86_64yum install wget -ywget /get/mysql-community-release-el6-5.noarch.rpmyum install mysql-community-release-el6-5.noarch.rpm -y原⽂件:修改之后:--> 解决依赖关系完成错误:软件包:2:postfix-2.10.1-6.el7.x86_64 (@anaconda)需要:libmysqlclient.so.18()(64bit)正在删除: 1:mariadb-libs-5.5.56-2.el7.x86_64 (@anaconda)libmysqlclient.so.18()(64bit)取代,由: mysql-community-libs-5.7.28-1.el7.x86_64 (/mysql-community-libs-5.7.28-1.el7.x86_64) ~libmysqlclient.so.20()(64bit)错误:软件包:2:postfix-2.10.1-6.el7.x86_64 (@anaconda)需要:libmysqlclient.so.18(libmysqlclient_18)(64bit)正在删除: 1:mariadb-libs-5.5.56-2.el7.x86_64 (@anaconda)libmysqlclient.so.18(libmysqlclient_18)(64bit)取代,由: mysql-community-libs-5.7.28-1.el7.x86_64 (/mysql-community-libs-5.7.28-1.el7.x86_64)未找到您可以尝试添加 --skip-broken 选项来解决该问题您可以尝试执⾏:rpm -Va --nofiles --nodigest原因是:存在mariadb-libs。

Linux mysql5.7.13安装教程(通用3篇)

Linux mysql5.7.13安装教程(通用3篇)

Linux mysql5.7.13安装教程(通用3篇)Linux mysql5.7.13安装教程(篇1)一、系统要求与准备在安装MySQL 5.7.13之前,确保您的Linux系统满足以下要求:操作系统:支持MySQL 5.7的Linux发行版,如CentOS 7, Ubuntu 16.04等。

内存:至少1GB内存。

存储空间:至少2GB的可用磁盘空间。

用户权限:使用具有sudo权限的用户来执行安装和配置任务。

同时,建议您关闭SELinux或将其设置为宽容模式,以避免在安装过程中出现问题。

二、下载MySQL安装包访问MySQL官方网站或官方软件仓库,下载MySQL 5.7.13的安装包。

确保选择与您的Linux发行版兼容的版本。

下载后的安装包通常以.tar.gz格式存在。

三、安装依赖包在安装MySQL之前,您需要安装一些必要的依赖包。

根据您的Linux发行版,执行以下命令来安装依赖:对于CentOS/RHEL系统:bashsudo yum install -y libaio libaio-devel对于Ubuntu/Debian系统:bashsudo apt-get install -y libaio1 libaio-dev四、创建MySQL用户和组为了确保MySQL的安全运行,您需要创建一个名为mysql的用户和组,并将MySQL的相关文件和目录归属于该用户和组。

bashsudo groupadd mysqlsudo useradd -r -g mysql -s/bin/false mysql五、解压并安装MySQL将下载的MySQL安装包解压到适当的位置,并将其目录更改为MySQL的安装目录。

例如,将安装包解压到/usr/local/目录下:bashcd /usr/local/sudo tar -zxvf /path/to/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gzsudo ln -s mysql-5.7.13-linux-glibc2.5-x86_64 mysql六、初始化数据库使用mysqld命令初始化MySQL数据库,并生成必要的系统表和配置文件。

MySQL5.7安装

MySQL5.7安装

目录1.1 安装MySQL5.7 (2)1.1.1 上传安装介质并解压 (2)1.1.2 软件配置 (2)1.1.3 创建mysql用户 (2)1.1.4 创建安装路径并复制软件包至路径下 (2)1.1.5 初始化MySQL (3)1.1.6 添加MySQL服务 (3)1.1.7 登陆MySQL (3)1.1安装MySQL5.71.1.1上传安装介质并解压mkdir /mysqlsofttar –zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz1.1.2软件配置打开/etc/f文件查看配置。

客户并未提出特殊要求,故按照默认路径安装。

vi /etc/f添加basedir=/var/lib/mysql修改datadir=/var/lib/mysql/data1.1.3创建mysql用户groupadd mysqluseradd –g mysql mysql1.1.4创建安装路径并复制软件包至路径下mkdir /var/lib/mysqlcp –r /mysqlsoft/mysql-5.7.21-linux-glibc2.12-x86_64/* /var/lib/mysqlmkdir /var/lib/mysql/datachmod 775 /var/lib/mysqlchown -R mysql /var/lib/mysqlchgrp -R mysql /var/lib/mysql1.1.5初始化MySQL.进入mysql文件夹下bin目录初始化,并记录初始密码./mysqld –initialize1.1.6添加MySQL服务将mysql文件夹下support-files目录下mysql.server复制到/etc/init.d/mysql下,并启动服务cp /var/lib/mysql/support-files/mysql.server /etc/init.d/mysqlservice mysql start1.1.7登陆MySQLmysql –u root –p。

MySQL5.7解压版安装教程

MySQL5.7解压版安装教程

MySQL5.7解压版安装教程MySQL5.7解压版安装教程为什么要写关于MySQL5.7的安装教程?1.⽬前⼤多使⽤的就是MySQL5.7版本的数据库,8.0的太新,5.5的太旧。

2.因为在MySQL5.5版有个⾮常好的配置字符集的exe⽂件MySQLInstanceConfig.exe,但新版没有,就只能⽤zip版安装再配置,这也是个⼈感觉不是很好的地⽅。

零、卸载MySQL卸载前⼀定要备份数据哦~1、检查mysql的服务是否正在运⾏(1)⽅式⼀:启动任务管理-->服务-->mysql服务(2)⽅式⼆我的电脑(计算机)-->右键-->管理-->服务2、卸载⽅式⼀:控制⾯板⽅式⼆:电脑管家或360安全卫⼠⽅式三:⽤安装程序⾃带的卸载程序3、清理遗留⽂件①找到之前的安装⽬录,清理如果你是默认安装的,要注意,mysql的默认的数据⽬录,是在⼀个隐藏⽂件夹中:C:\ProgramData\MySQL②到mysql的安装⽬录,⼀般在C:\Program Files(x86),将mysql相关⽂件夹删除;③如果部分mysql相关⽂件安装在其他盘⾥,记得去清理⼀下,⼀般直接点击右键删除即可,实在删除不了,⽤360粉碎,或者重启下电脑再删除;④删除系统盘下(C盘)ProgramData⽬录下的mysql相关⽬录,ProgramData⽬录系统是默认隐藏的,可通过如下办法——在“隐藏的项⽬”前打上对勾,显⽰系统隐藏的⽬录;⑤删除C盘Users下相关⽂件——C:\Users\(⽤户名)\AppData⽬录下每⼀个⽂件夹⾥都找找MySQL⽂件名,并删除;4、清理注册表通过快捷键 “win+R” 进⼊"运⾏"框,然后输⼊regedit进⼊注册表编辑器1.在编辑器⾥,点击上⽅⼯具栏:编辑——查找——输⼊mysql进⾏查找,查找到的mysql相关的统统删除;HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL服务⽬录删除HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MySQL服务⽬录删除HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog\Application\MySQL服务⽬录删除HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\MySQL服务⽬录删除HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MySQL服务⽬录删除HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL服务删除注册表中的ControlSet001,ControlSet002,不⼀定是001和002,可能是ControlSet005、006之类⼀、解压MySQL5.7从⽹上下载zip版的myql,并解压。

MySQL5.7解压版安装教程(图文详细)[Windows]

MySQL5.7解压版安装教程(图文详细)[Windows]

MySQL5.7解压版安装教程(图⽂详细)[Windows]最近在学习中⽤到了MySQL数据库,在安装过程中遇到了不少问题,在翻了⼤半天百度后,问题基本都解决了,所以写⼀篇MySQL5.7 解压版的图⽂详细安装教程。

⾄于为什么我会选择解压版⽽不是安装版,⼀是因为安装版没有64位版本;⼆是因为安装版的软件在重装系统或者挪动软件的位置后,就会出现⽆法使⽤的情况,⽽⼤部分绿⾊版或者解压版的软件就不存在这样的问题,只需要重新配置⼀下即可使⽤。

如果你是刚接触MySQL的同学,安装版也是你不错的选择,安装时⽆脑点下⼀步基本就可以装好,默认参数程序都会给你配好,既简单⼜⽅便。

如果你是像我⼀样喜欢折腾的⼈,你也可以选择解压版。

安装环境:Win10 64位软件版本:MySQL 5.7.24 解压版如果你的安装环境和软件版本跟上⾯⼀样,按照下⾯的⽅法安装是基本没有问题的下载下载就不⽤我多说了吧,点开下⾯的链接:翻到接近页⾯底部的地⽅找到如下图所⽰的位置:选择选择和⾃⼰系统位数相对应的版本点击右边的Download,此时会进到另⼀个页⾯,同样在接近页⾯底部的地⽅找到如下图所⽰的位置:不⽤理会上⾯的登录和注册按钮,直接点击No thanks, just start my download.就可以下载。

安装(解压+优化)下载完成后我们得到的是⼀个压缩包(这不是废话吗),将其解压,我们就可以得到MySQL 5.7的软件本体了(就是⼀个⽂件夹),我们可以把它放在你想安装的位置(为了演⽰⽅便,我放在了D盘根⽬录下)。

有的同学可能看了⼀眼⽬录的⼤⼩,1.64G...(内⼼OS:我了个去,怎么300M左右的东西解压后这么⼤!)其实不⽤担⼼,⽂件夹⾥⾯的⼀些东西是可以删掉的,并不会影响正常使⽤,⾄少在我⾃⼰使⽤的时候没有问题(如果在某种情况下可能有问题,恳请⼤神指教),我们可以删除⽂件夹⾥的lib⽬录(约1.28G)和bin⽬录下的mysqld.pdb⽂件(约162M),根据在找到的说法,这是为了可以重新编译MySQL和调试⽽存在的,我们只是为了使⽤它,并不打算修改,所以可以直接删掉。

MySql5.7的下载安装

MySql5.7的下载安装

MySql5.7的下载安装1、下载安装包2、安装根据⾃⼰需要选择安装类型即可,因为不使⽤这个⽅法安装的,这⾥就不再赘述,可直接参考:解压安装包(按⾃⼰需求选择存放的地⽅)在解压⽬录下新建my.ini⽂件编辑my.ini⽂件,内容如下[Client]#设置3306端⼝port = 3306[mysqld]#设置3306端⼝port = 3306# 服务端使⽤的字符集默认为8⽐特编码的latin1字符集character-set-server=utf8# 设置mysql的安装⽬录basedir=D:\Program Files\MySql\mysql-5.7.36-winx64# 设置mysql数据库的数据的存放⽬录datadir=D:\Program Files\MySql\mysql-5.7.36-winx64\data# 允许最⼤连接数max_connections=200# 创建新表时将使⽤的默认存储引擎default-storage-engine=INNODBsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES[mysql]# 设置mysql客户端默认字符集default-character-set=utf8配置环境变量变量名称:MYSQL_HOME变量值:D:\Program Files\MySql\mysql-5.7.36-winx64(根据⾃⼰的MySQL安装⽬录路径)修改Path变量变量值:%MYSQL_HOME%\bin安装MySqlwin7系统的可以在解压⽬录的\bin下,按住键盘Ctrl+Shift,然后右击⿏标打开命令窗⼝。

如果是直接打开cmd(管理员⾝份运⾏)的操作如下安装数据库,输⼊mysqld -install初始化数据库,输⼊mysqld --initialize --consolemysqld --initialize 的⽬的是初始化data⽬录,否则mysql⽬录⾥不会出现data⽂件夹图中初始密码: );mam0izX2i2启动MySql服务输⼊net start mysql修改root密码输⼊mysql -u root -p,密码输⼊那个初始密码输⼊alter user 'root'@'localhost' identified by '123';输⼊flush privilegesflush privileges 命令本质上的作⽤是将当前user和privilige表中的⽤户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存⾥。

MySQL5.7的安装与配置详细操作步骤

MySQL5.7的安装与配置详细操作步骤

MySQL5.7的安装与配置详细操作步骤⼀、MySQL的下载⼆、解压安装包将下载的ZIP压缩包解压到任意⽂件夹。

(此处为: C:\mysql5.7)三、修改配置⽂件将解压⽂件夹⽬录下的my-default.ini ⽂件重命名为 my.ini 。

⽤⽂本编辑器打开并清空其中内容。

添加内容(参考互联⽹):[mysql]# 设置mysql客户端默认字符集default-character-set=utf8[mysqld]#设置3306端⼝port = 3306# 设置mysql的安装⽬录basedir=C:\mysql5.7# 设置mysql数据库的数据的存放⽬录datadir=C:\mysql5.7\data# 允许最⼤连接数max_connections=200# 服务端使⽤的字符集默认为8⽐特编码的latin1字符集character-set-server=utf8# 创建新表时将使⽤的默认存储引擎default-storage-engine=INNODB注:basedir和datadir使⽤⾃⼰的实际路径替换。

MySQL5.7版本的压缩包初始解压后的⽂件夹⽬录中并不包含data⽂件夹,不⽤担⼼,后⾯会⽤命令进⾏初始化创建。

此处不需要⼿动创建。

修改完成后保存退出。

四、配置环境变量在Path环境变量⾥添加 C:\mysql5.7\bin (此处以实际的bin⽬录的路径进⾏替换)注:与前⾯的环境变量⽤;进⾏分隔五、安装MySQL以管理员⾝份运⾏cmd窗⼝。

切换到 C:/mysql5.7/bin ⽬录下按顺序输⼊以下命令:1. mysqld install 等待提⽰安装成功2. mysqld --initialize 初始化data⽬录3. net start mysql 启动服务六、修改root⽤户的密码在进⾏完以上五步之后运⾏ mysql -u root -p , 由于root⽤户默认是没有密码的,直接回车进⼊。

MySQL5.7安装步骤-64位

MySQL5.7安装步骤-64位

MySQL5.7安装步骤(windows10/8_64位)1下载MySQL Community Server 5.7.13(或其他版本)下载地址:/downloads/mysql/2解压MySQL压缩包解压后的文件结构:3配置环境变量添加一个MYSQL_HOME变量:在PATH变量上配置上:4修改mysql配置文件my-default.ini5向本地服务添加mysql服务项以管理员身份运行cmd进入mysql文件存放目录安装服务运行命令:mysqld install MySQL --defaults-file="E:\SoftwareFiles\mysql-5.7.13-winx64\my-default.ini"打开服务窗口查看一下是否安装正确:查看MySQL属性的可执行文件的路径是否正确:my-default.ini文件所在目录6运行mysql初始化命令:命令:mysqld--initialize运行完成后mysql的文件目录会多一个data文件目录:Data文件目录下的文件7启动mysql服务8为root用户重置密码关闭MySQL服务用安全模式打开,mysqld --skip-grant-tables本窗口不要关再重新打开一个窗口登录mysql -u root –p密码为空,直接回车打开数据库mysql:use mysql;以前数据中保存密码的字段是password,5.7的是authentication_string字段,可以select * from user,查看一下。

修改密码:update user set authentication_string=password("123456") where user="root";最后:flush privileges;就OK了。

将mysqlId.exe进程杀死然后重启mysql服务9重新SET密码终于完成了。

Windows下MySQL 5.7安装

Windows下MySQL 5.7安装

Windows下MySQL 5.6安装沈阳昂立信息技术有限公司目录1MySQL概述 (4)2安装前准备 (4)3MySQL安装 (6)3.1第一步 (6)3.2第二步 (7)3.3第三步 (7)3.4第四步 (8)3.5第五步 (9)4测试安装 (19)5导出\导入数据库 (19)5.1终端方式导出 (19)5.1.1第一步 (19)5.1.2第二步 (20)5.1.3第三步 (21)5.2终端方式导入 (21)5.2.1第一步 (21)5.2.2第二步 (22)5.2.3第三步 (23)5.3Cmd方式导出 (24)5.3.1第一步 (24)5.3.2第二步 (24)5.3.3第三步 (24)5.4Cmd方式导入 (24)5.4.1第一步 (24)5.4.2第二步 (25)5.4.3第一步 (25)1MySQL概述MySQL是一种开源的关系型数据库管理系统(RDBMS),MySQL 数据库系统使用最常用的数据库管理语言--结构化查询语言(SQL)进行数据库管理。

MySQL特点✓开源✓免费✓跨平台2安装前准备下载安装程序包,下载地址:/downloads/ Mysql多个版本说明:1.MySQL Community Server 社区版本,开源免费,但不提供官方技术支持。

2. MySQL Enterprise Edition 企业版本,需付费,可以试用30天。

3. MySQL Cluster 集群版,开源免费。

可将几个MySQL Server封装成一个Server。

4. MySQL Cluster CGE 高级集群版,需付费。

5. MySQL Workbench(GUITOOL)专为MySQL设计ER/数据库建模工具。

下图中有msi、zip两种安装文件格式供选择,都可以安装使用,区别为msi安装为向导式安装无需配置,zip格式安装需要自行配置。

先以msi安装为例。

或者下面地址下载。

/downloads/file/?id=466291上图中可以登录下载,也可以不登录直接下载。

mysql5.7安装教程(windows)

mysql5.7安装教程(windows)

mysql5.7安装教程(windows)mysql5.7安装配置⽅法,整理⼀份分享给⼤家下载安装双击mysql.msi,按照提⽰安装。

安装之后需要注意的问题(重点)设置mysql环境环境变量(让mysql在cmd中的任何路径下就可以被调⽤)1、⿏标右击计算机,点击属性2、选择⾼级系统变量设置,点击环境变量3、在系统变量⾥⾯选择PATH,点击编辑4、在最后添加 ";C:\Program Files\MySQL\MySQL Server 5.7",(C:\Program Files\MySQL\MySQL Server 5.7为mysql安装的根⽬录,如果安装时你有更改,则输⼊更改后的路径,注意根⽬录前⾯有个 ; )点击确定后再点确定,退出初始化mysql1、进⼊mysql5.7安装后的根路径(默认安装路径为C:\Program Files\MySQL\MySQL Server 5.7,如果安装时你有更改,则为你更改后的路径),后⾯简称根⽬录2、mysql根⽬录结构如下3、在当前⽬录下复制⼀份my-default.ini改名为my.ini ,此时的⽬录结构为4、⽤记事本或者其他⽂本编辑器打开my.ini⽂件,在⽂件内容最后添加"skip_grant_tables",保存⽂件。

5、⽤cmd,进⼊根⽬录bin⽂件夹下按 windows Home键(键盘左下⾓alt键左边⼀个键,形似"⽥")+R,输⼊cmd后,按回车键在弹出的窗⼝输⼊ "cd C:\Program Files\MySQL\MySQL Server 5.7**bin**" 回车输⼊ "mysqld --initialize",回车,根⽬录下会⽣成data⽂件夹,此时mysql初始化完成,初始化完成后的根⽬录结构如下图将mysql注册为系统服务1、按windows Home键+R(键盘左下⾓alt键左边⼀个键,形似"⽥"),输⼊cmd后,按回车键2、在弹出的窗⼝输⼊ "cd C:\Program Files\MySQL\MySQL Server 5.7**bin**" 回车3、输⼊ "mysqld --install",回车,如下图(之前我已经注册过服务,所以会提⽰服务已经)4、现在就可以在cmd⾥⾯使⽤"net start mysql"来启动mysql服务,使⽤"net stop mysql"来停⽌服务了。

Mysql5.7服务下载安装图文教程(经典版)

Mysql5.7服务下载安装图文教程(经典版)

Mysql5.7服务下载安装图⽂教程(经典版)MySQL 5.7在诸多⽅⾯都进⾏了⼤幅的改进,主要在于安全性、灵活性、易⽤性、可⽤性和性能等⼏个⽅⾯。

下⾯我们通过图⽂并茂的⽅式给⼤家介绍Mysql5.7数据库的下载安装详细教程,⼀起看看吧!⼀、Mysql5.7下载1.百度搜索mysql,选择进⼊官⽹下载页2.点击下载安装版3.继续选择下载4.接下来就是有意思的了,显⽰提⽰⼤家登陆或者注册,但是搞笑的⼀点是左下⾓其实有⼀个快捷下载的链接,点击就好了,不需要注册登陆,哈哈,眼睛⼩的⼈,⼩编原谅你没看到,要知道,欧巴也是带着眼睛才看到滴5.然后静静的等着下载完成就好了,······⼆、Mysql5.7安装1.⾸先双击打开安装程序2.在弹出窗⼝中选择安装类型,因为⾃带的⼯具太多,⽽⼩编还有点⼩⼩的软件洁癖,所以选择只安装服务Server,这就⾜够了,然后配合⼀个HeidiSQL(数据库图形化管理⼯具),就Perfect了,或者使⽤Navicat都可以的,然后下⼀步3.选择安装⽬录,有时候安装程序不会像这样让⼤家选择安装⽬录,⼤家也只好接受了,让他默认安装C盘好了,然后下⼀步4.点击执⾏,等待完成,然后下⼀步5.继续下⼀步6.这不很重要,选择mysql5.7服务的端⼝号,⼀般选择3306就可以,或者3308什么的,只要端⼝不冲突就好7.两次输⼊密码,⼀定要记牢了,要不使⽤登录的时候就JJ了,然后下⼀步8.继续下⼀步9.点击执⾏,等待完成,然后Finish到此结束,安装成功!以上所述是⼩编给⼤家介绍的Mysql 5.7 服务下载安装图⽂教程(经典版),希望对⼤家有所帮助,如果⼤家有任何疑问请给我留⾔,⼩编会及时回复⼤家的。

在此也⾮常感谢⼤家对⽹站的⽀持!。

Mysql5.7安装步骤

Mysql5.7安装步骤

Mysql5.7Linux安装详细步骤1、下载安装包/downloads/mysql/#downloads推荐下载通用安装方法的TAR包(//Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64. tar)。

2.检查库文件是否存在,如有删除。

[root@localhost Desktop]$ rpm -qa | grep mysqlmysql-libs-5.1.52-1.el6_0.1.x86_64 [root@localhost ~]# rpm -e mysql-libs-5.1.52.x86_64 –nodeps[root@localhost ~]#3.检查mysql组和用户是否存在,如无创建。

[root@localhost ~]# cat /etc/group | grep mysqlmysql:x:490:[root@localhost ~]# cat /etc/passwd | grep mysqlmysql:x:496:490::/home/mysql:/bin/bash以上为默认存在的情况,如无,执行添加命令:[root@localhost ~]#groupadd mysql[root@localhost ~]#useradd -r -g mysql mysql//useradd -r参数表示mysql用户是系统用户,不可用于登录系统。

4.解压TAR包,更改所属的组和用户[root@localhost ~]# cd /usr/local/[root@localhost local]# tar xvf mysql-5.7.12-linux-glibc2.5-x86_64.tar[root@localhost local]# ls -ltotal 1306432-rwxr–r–. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar-rw-r–r–. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz-rw-r–r–. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gz[root@localhost local]# tar xvfz mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz [root@localhost local]# mv mysql-5.7.12-linux-glibc2.5-x86_64 mysql[root@localhost local]# ls -ltotal 1306436drwxr-xr-x. 2 root root 4096 Dec 4 2009 bindrwxr-xr-x. 2 root root 4096 Dec 4 2009 etcdrwxr-xr-x. 2 root root 4096 Dec 4 2009 gamesdrwxr-xr-x. 2 root root 4096 Dec 4 2009 includedrwxr-xr-x. 2 root root 4096 Dec 4 2009 libdrwxr-xr-x. 3 root root 4096 Dec 2 14:36 lib64drwxr-xr-x. 2 root root 4096 Dec 4 2009 libexecdrwxr-xr-x. 9 7161 wheel 4096 Mar 28 12:51 mysql-rwxr–r–. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar-rw-r–r–. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz-rw-r–r–. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gzdrwxr-xr-x. 2 root root 4096 Dec 4 2009 sbindrwxr-xr-x. 6 root root 4096 Dec 2 14:36 sharedrwxr-xr-x. 2 root root 4096 Dec 4 2009 src[root@localhost local]# chown -R mysql mysql/[root@localhost local]# chgrp -R mysql mysql/ [root@localhost local]# cd mysql/5.安装和初始化数据库[root@localhost mysql]# bin/mysql_install_db –user=mysql –basedir=/usr/local/mysql/ –datadir=/usr/local/mysql/data/2016-06-01 15:23:25 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld –initialize2016-06-01 15:23:30 [WARNING] The bootstrap log isn’t empty:2016-06-01 15:23:30 [WARNING] 2016-06-01T22:23:25.491840Z 0 [Warning] –bootstrap is deprecated. Please consider using –initialize instead2016-06-01T22:23:25.492256Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)2016-06-01T22:23:25.492260Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000) ———————-如果改变默认安装路径,则需要1)/etc/f、/etc/init.d/mysqld中修改basedir=’/apps/mysql’datadir=’/apps/mysql/data’2)创建lnmkdir -p /usr/local/mysql/binln -s /apps/mysql/bin/mysqld /usr/local/mysql/bin/mysqld———————-[root@localhost mysql]#[root@localhost mysql]# cp -a ./support-files/f /etc/f[root@localhost mysql]# cp -a ./support-files/mysql.server /etc/init.d/mysqld [root@localhost mysql]# cd bin/[root@localhost bin]# ./mysqld_safe –user=mysql &[1] 2932[root@localhost bin]# 2016-06-01T22:27:09.708557Z mysqld_safe Logging to ‘/usr/local/mysql/data/localhost.localdomain.err’.2016-06-01T22:27:09.854913Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data[root@localhost bin]# /etc/init.d/mysqld restartShutting down MySQL..2016-06-01T22:27:50.498694Z mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid endedSUCCESS!Starting MySQL. SUCCESS![1]+ Done ./mysqld_safe –user=mysql[root@localhost bin]#//设置开机启动[root@localhost bin]# chkconfig –level 35 mysqld on[root@localhost bin]#6.初始化密码 mysql5.7会生成一个初始化密码,而在之前的版本首次登陆不需要登录。

CentosMySQL5.7安装、升级教程

CentosMySQL5.7安装、升级教程

CentosMySQL5.7安装、升级教程MySQL 5.7安装、升级笔记分享:卸载当前的 MySQL查看当前 MySQL 版本:[root@coderknock ~]# mysql -Vmysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (i386) using readline 5.1停⽌ MySQL 服务[root@coderknock ~]# service mysqld stopStopping mysqld: [ OK ]备份数据【数据不重要可以忽略】备份数据库,升级MySQL通常不会丢失数据,但保险起见,我们需要做这⼀步。

输⼊命令:[root@coderknock ~]# mysqldump -u xxx -h xxx -P 3306 -p --all-databases > databases.sql卸载旧版本 MySQL[root@coderknock ~]# yum remove mysql mysql-*Loaded plugins: securitySetting up Remove ProcessResolving Dependencies--> Running transaction check---> Package mysql.i686 0:5.1.73-7.el6 will be erased---> Package mysql-libs.i686 0:5.1.73-7.el6 will be erased--> Processing Dependency: libmysqlclient.so.16 for package: 2:postfix-2.6.6-6.el6_7.1.i686--> Processing Dependency: libmysqlclient.so.16 for package: perl-DBD-MySQL-4.013-3.el6.i686--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16) for package: 2:postfix-2.6.6-6.el6_7.1.i686--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16) for package: perl-DBD-MySQL-4.013-3.el6.i686--> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-6.el6_7.1.i686---> Package mysql-server.i686 0:5.1.73-7.el6 will be erased--> Running transaction check---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 will be erased---> Package postfix.i686 2:2.6.6-6.el6_7.1 will be erased--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-16.el6_8.2.i686--> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-core-4.0-7.el6.centos.i686--> Running transaction check---> Package cronie.i686 0:1.4.4-16.el6_8.2 will be erased--> Processing Dependency: cronie = 1.4.4-16.el6_8.2 for package: cronie-anacron-1.4.4-16.el6_8.2.i686---> Package redhat-lsb-core.i686 0:4.0-7.el6.centos will be erased--> Running transaction check---> Package cronie-anacron.i686 0:1.4.4-16.el6_8.2 will be erased--> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch--> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-31.el6.i686--> Restarting Dependency Resolution with new changes.--> Running transaction check---> Package crontabs.noarch 0:1.10-33.el6 will be erased---> Package sysstat.i686 0:9.0.4-31.el6 will be erased--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================ Package Arch Version Repository Size============================================================================================================================================================================================ Removing:mysql i686 5.1.73-7.el6 @base 2.3 Mmysql-libs i686 5.1.73-7.el6 @base 3.9 Mmysql-server i686 5.1.73-7.el6 @base 24 MRemoving for dependencies:cronie i686 1.4.4-16.el6_8.2 @updates 169 kcronie-anacron i686 1.4.4-16.el6_8.2 @updates 38 kcrontabs noarch 1.10-33.el6 @anaconda-CentOS-201311291201.i386/6.5 2.4 kperl-DBD-MySQL i686 4.013-3.el6 @base 341 kpostfix i686 2:2.6.6-6.el6_7.1 @base 9.3 Mredhat-lsb-core i686 4.0-7.el6.centos @anaconda-CentOS-201311291201.i386/6.5 22 ksysstat i686 9.0.4-31.el6 @base 804 kTransaction Summary============================================================================================================================================================================================ Remove 10 Package(s)Installed size: 41 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionErasing : mysql-server-5.1.73-7.el6.i686 1/10warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsaveErasing : redhat-lsb-core-4.0-7.el6.centos.i686 2/10/var/tmp/rpm-tmp.Y5QGjy: line 1: lsb_release: command not foundErasing : mysql-5.1.73-7.el6.i686 3/10Erasing : perl-DBD-MySQL-4.013-3.el6.i686 4/10Erasing : sysstat-9.0.4-31.el6.i686 5/10Erasing : crontabs-1.10-33.el6.noarch 6/10Erasing : cronie-anacron-1.4.4-16.el6_8.2.i686 7/10Erasing : cronie-1.4.4-16.el6_8.2.i686 8/10Erasing : 2:postfix-2.6.6-6.el6_7.1.i686 9/10Erasing : mysql-libs-5.1.73-7.el6.i686 10/10Verifying : redhat-lsb-core-4.0-7.el6.centos.i686 1/10Verifying : perl-DBD-MySQL-4.013-3.el6.i686 2/10Verifying : mysql-server-5.1.73-7.el6.i686 3/10Verifying : crontabs-1.10-33.el6.noarch 4/10Verifying : sysstat-9.0.4-31.el6.i686 5/10Verifying : cronie-anacron-1.4.4-16.el6_8.2.i686 6/10Verifying : cronie-1.4.4-16.el6_8.2.i686 7/10Verifying : mysql-libs-5.1.73-7.el6.i686 8/10Verifying : mysql-5.1.73-7.el6.i686 9/10Verifying : 2:postfix-2.6.6-6.el6_7.1.i686 10/10Removed:mysql.i686 0:5.1.73-7.el6 mysql-libs.i686 0:5.1.73-7.el6 mysql-server.i686 0:5.1.73-7.el6Dependency Removed:cronie.i686 0:1.4.4-16.el6_8.2 cronie-anacron.i686 0:1.4.4-16.el6_8.2 crontabs.noarch 0:1.10-33.el6 perl-DBD-MySQL.i686 0:4.013-3.el6 postfix.i686 2:2.6.6-6.el6_7.1redhat-lsb-core.i686 0:4.0-7.el6.centos sysstat.i686 0:9.0.4-31.el6Complete!这样就卸载完成了,为了保险起见我们检查⼀下系统中是否还有 MySQL 相关内容没有删除⼲净[root@coderknock ~]# yum list installed | grep mysql[root@coderknock ~]#上⾯的情况是没有未删除部分,如果有的话可通过下⾯的命令删除:[root@coderknock ~]# yum remove mysql-libs下载最新版本的 MySQL查看系统配置信息选择对应 MySQL 包[root@coderknock ~]# uname -r3.10.104-1.el6.elrepo.i686在浏览器打开 sohu提供的然后根据⾃⼰系统配置选择对应的 rpm 包,右键复制⽂件链接,我的选择如下:下载并解压[root@coderknock ~]# wget /mysql/MySQL-5.7/mysql-5.7.17-1.el6.i686.rpm-bundle.tar--2017-01-06 22:46:15-- /mysql/MySQL-5.7/mysql-5.7.17-1.el6.i686.rpm-bundle.tarResolving ... 119.188.36.70Connecting to |119.188.36.70|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 448163840 (427M) [application/octet-stream]Saving to: “mysql-5.7.17-1.el6.i686.rpm-bundle.tar”100%[=============================================================================================================================================================>] 448,163,840 9.98M/s in 45s 2017-01-06 22:47:00 (9.54 MB/s) - “mysql-5.7.17-1.el6.i686.rpm-bundle.tar” saved [448163840/448163840][root@coderknock ~]# tar xvf mysql-5.7.17-1.el6.i686.rpm-bundle.tarmysql-community-libs-compat-5.7.17-1.el6.i686.rpmmysql-community-client-5.7.17-1.el6.i686.rpmmysql-community-embedded-devel-5.7.17-1.el6.i686.rpmmysql-community-devel-5.7.17-1.el6.i686.rpmmysql-community-common-5.7.17-1.el6.i686.rpmmysql-community-test-5.7.17-1.el6.i686.rpmmysql-community-embedded-5.7.17-1.el6.i686.rpmmysql-community-libs-5.7.17-1.el6.i686.rpmmysql-community-server-5.7.17-1.el6.i686.rpm安装及配置安装 rpm 【有依赖关系,请按下⾯的步骤安装,搜索 [root@coderknock ~]# 可跳过安装⽇志直接查看相关命令】[root@coderknock ~]# yum localinstall mysql-community-common-5.7.17-1.el6.i686.rpmLoaded plugins: securitySetting up Local Package ProcessExamining mysql-community-common-5.7.17-1.el6.i686.rpm: mysql-community-common-5.7.17-1.el6.i686Marking mysql-community-common-5.7.17-1.el6.i686.rpm to be installedResolving Dependencies--> Running transaction check---> Package mysql-community-common.i686 0:5.7.17-1.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================ Package Arch Version Repository Size============================================================================================================================================================================================ Installing:mysql-community-common i686 5.7.17-1.el6 /mysql-community-common-5.7.17-1.el6.i686 2.5 MTransaction Summary============================================================================================================================================================================================ Install 1 Package(s)Total size: 2.5 MInstalled size: 2.5 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : mysql-community-common-5.7.17-1.el6.i686 1/1Verifying : mysql-community-common-5.7.17-1.el6.i686 1/1Installed:mysql-community-common.i686 0:5.7.17-1.el6Complete![root@coderknock ~]# yum localinstall mysql-community-libs-5.7.17-1.el6.i686.rpmLoaded plugins: securitySetting up Local Package ProcessExamining mysql-community-libs-5.7.17-1.el6.i686.rpm: mysql-community-libs-5.7.17-1.el6.i686Marking mysql-community-libs-5.7.17-1.el6.i686.rpm to be installedResolving Dependencies--> Running transaction check---> Package mysql-community-libs.i686 0:5.7.17-1.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================ Package Arch Version Repository Size============================================================================================================================================================================================ Installing:mysql-community-libs i686 5.7.17-1.el6 /mysql-community-libs-5.7.17-1.el6.i686 7.8 MTransaction Summary============================================================================================================================================================================================ Install 1 Package(s)Total size: 7.8 MInstalled size: 7.8 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : mysql-community-libs-5.7.17-1.el6.i686 1/1Verifying : mysql-community-libs-5.7.17-1.el6.i686 1/1Installed:mysql-community-libs.i686 0:5.7.17-1.el6Complete![root@coderknock ~]# yum localinstall mysql-community-client-5.7.17-1.el6.i686.rpmLoaded plugins: securitySetting up Local Package ProcessExamining mysql-community-client-5.7.17-1.el6.i686.rpm: mysql-community-client-5.7.17-1.el6.i686Marking mysql-community-client-5.7.17-1.el6.i686.rpm to be installedResolving Dependencies--> Running transaction check---> Package mysql-community-client.i686 0:5.7.17-1.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================ Package Arch Version Repository Size============================================================================================================================================================================================ Installing:mysql-community-client i686 5.7.17-1.el6 /mysql-community-client-5.7.17-1.el6.i686 87 MTransaction Summary============================================================================================================================================================================================ Install 1 Package(s)Total size: 87 MInstalled size: 87 MIs this ok [y/N]: ^[[A^HyIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : mysql-community-client-5.7.17-1.el6.i686 1/1Verifying : mysql-community-client-5.7.17-1.el6.i686 1/1Installed:mysql-community-client.i686 0:5.7.17-1.el6Complete![root@coderknock ~]# yum localinstall mysql-community-server-5.7.17-1.el6.i686.rpmLoaded plugins: securitySetting up Local Package ProcessExamining mysql-community-server-5.7.17-1.el6.i686.rpm: mysql-community-server-5.7.17-1.el6.i686Marking mysql-community-server-5.7.17-1.el6.i686.rpm to be installedResolving Dependencies--> Running transaction check---> Package mysql-community-server.i686 0:5.7.17-1.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================ Package Arch Version Repository Size============================================================================================================================================================================================ Installing:mysql-community-server i686 5.7.17-1.el6 /mysql-community-server-5.7.17-1.el6.i686 695 MTransaction Summary============================================================================================================================================================================================ Install 1 Package(s)Total size: 695 MInstalled size: 695 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : mysql-community-server-5.7.17-1.el6.i686 1/1Verifying : mysql-community-server-5.7.17-1.el6.i686 1/1Installed:mysql-community-server.i686 0:5.7.17-1.el6Complete!配置查看版本[root@coderknock ~]# mysql -Vmysql Ver 14.14 Distrib 5.7.17, for Linux (i686) using EditLine wrapper启动 MySQL[root@coderknock ~]# service mysqld startMySQL Daemon failed to start.Starting mysqld: [FAILED]上⾯的情况说明启动失败,这是因为经过上⾯的步骤,MySQL 最新版已经安装到我们的系统了,但这是还没有初始化数据,所以导致⽆法启动。

mysql5.7安装-初始化-建库建表全过程

mysql5.7安装-初始化-建库建表全过程

mysql5.7安装-初始化-建库建表全过程【mysql 5.7 安装-初始化-建库建表全过程】1.安装MySQL 5.7MySQL从5.7.x以后,安装包中不再包含data⽬录,需要⾃⾏初始化。

2.初始化实例(1) win+r打开运⾏,输⼊cmd,打开命令⾏程序;(2)使⽤cd命令进⼊basedir⽬录(也就是你的mysql⽬录);(3)输⼊bin\mysqld --initialize-insecure直接回车,⾃动执⾏初始化...稍等⼀会就OK了,很快。

3.启动mysql服务,并登录mysql,修改⽤户密码。

上⼀步“-insecure”参数会⽣成⼀个密码为空的root⽤户,需要修改密码。

(1)命令⾏定位到MySQL⽬录;(2)输⼊bin\mysqld,启动mysql服务,此时,当前进程卡住不动,查看任务管理器,见到mysqld.exe进程则为启动成功;(3)重新打开⼀个新的命令⾏窗⼝;(4)执⾏bin\mysql -u root -p回车,密码为空直接再回车,进⼊mysql;(5)命令⾏前缀前缀改成 mysql> 说明连接MySQL成功;(6)修改密码:mysql>alter user 'root'@'localhost' identified by 'new pwd';回车(注意最后的分号;)。

⾄此,整个数据库的初始化过程完成!4.建库建表以下为sql客户端软件的建库建表操作记录,其中红⾊字体语句为有效输出。

/*[23:02:50][3 ms]*/ SHOW DATABASES;/*[23:03:05][0 ms]*/ SHOW CHARSET;/*[23:03:05][2 ms]*/ SHOW COLLATION;/*[23:06:25][1 ms]*/ CREATE DATABASE `just4test`CHARACTER SET utf8 COLLATE utf8_general_ci;/*[23:06:26][0 ms]*/ SHOW DATABASES;/*[23:06:26][0 ms]*/ USE `just4test`;/*[23:06:29][1 ms]*/ SHOW FULL TABLES FROM `just4test` WHERE table_type = 'BASE TABLE';/*[23:06:37][0 ms]*/ SHOW CHARSET;/*[23:11:57][25 ms]*/ CREATE TABLE `just4test`.`user`( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,`name` VARCHAR(50), `age` INT, PRIMARY KEY (`id`) ) ENGINE=INNODB COMMENT='⽤户表';/*[23:12:01][4 ms]*/ SHOW TABLE STATUS FROM `just4test` LIKE 'user';/*[23:12:01][0 ms]*/ SHOW CHARSET;/*[23:12:01][0 ms]*/ SHOW FULL FIELDS FROM `just4test`.`user`;/*[23:12:01][1 ms]*/ SHOW KEYS FROM `just4test`.`user`;/*[23:12:01][1 ms]*/ SHOW COLLATION;/*[23:12:01][0 ms]*/ SHOW FULL TABLES FROM `just4test` WHERE table_type = 'BASE TABLE';/*[23:12:01][0 ms]*/ SHOW FULL TABLES FROM `just4test` WHERE table_type = 'BASE TABLE';/*[23:14:35][1 ms]*/ SELECT * FROM `just4test`.`user` LIMIT 0, 1000;/*[23:14:35][0 ms]*/ SHOW CREATE TABLE `just4test`.`user`;/*[23:14:35][1 ms]*/ SHOW FULL FIELDS FROM `just4test`.`user`;/*[23:14:35][0 ms]*/ SHOW KEYS FROM `just4test`.`user`;/*[23:15:01][2 ms]*/ INSERT INTO `just4test`.`user` (`name`, `age`) VALUES ('张三', '18');/*[23:15:10][0 ms]*/ SELECT * FROM `just4test`.`user` LIMIT 0, 1000;。

离线安装mysql5.7教程

离线安装mysql5.7教程

离线安装mysql5.7教程转发链接:2)查询并卸载系统⾃带的Mariadbrpm -qa | grep mariadbrpm -e --nodeps ⽂件名3)安装实施建⽴⽤户,为了⽅便数据库管理,对于安装的MySQL数据库,⽣产上我们都会建⽴⼀个mysql⽤户和mysql⽤户组:# 添加mysql⽤户组groupadd mysql# 添加mysql⽤户useradd -g mysql mysql -d /home/mysql# 修改mysql⽤户的登陆密码passwd mysql4)创建临时⽬录、数据⽬录和⽇志⽬录# 添加mysql⽤户组groupadd mysql# 添加mysql⽤户useradd -g mysql mysql -d /home/mysql# 修改mysql⽤户的登陆密码passwd mysql5)上传⾄服务器上传 mysql-5.7.21-linux-glibc2.12-x86_64.tar 安装包到 /usr/local ⽬录下# 解压缩tar -xvf mysql-5.7.30-linux-glibc2.12-x86_64.tar# 会得到⼀个mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz⽂件,再解压缩tar -zxvf mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz# 建⽴软链接,便于以后版本升级ln -s mysql-5.7.30-linux-glibc2.12-x86_64 mysql# 修改mysql⽂件夹下所有⽂件的⽤户和⽤户组chown -R mysql:mysql mysql/6)创建配置⽂件# 创建配置⽂件 cd /etc# 在f⽂件中添加对应的配置项,⽂章末尾会提供⼀个默认的 f 配置【然后填⼊下⾯配置】 vi f[client] # 客户端设置,即客户端默认的连接参数port =3306 # 默认连接端⼝socket =/home/mysql/3306/tmp/mysql.sock # ⽤于本地连接的socket套接字,mysqld守护进程⽣成了这个⽂件[mysqld] # 服务端基本设置# 基础设置server-id =1 # Mysql服务的唯⼀编号每个mysql服务Id需唯⼀port =3306 # MySQL监听端⼝basedir =/usr/local/mysql # MySQL安装根⽬录datadir =/home/mysql/3306/data # MySQL数据⽂件所在位置tmpdir =/home/mysql/3306/tmp # 临时⽬录,⽐如load data infile会⽤到socket =/home/mysql/3306/tmp/mysql.sock # 为MySQL客户端程序和服务器之间的本地通讯指定⼀个套接字⽂件pid-file=/home/mysql/3306/log/mysql.pid # pid⽂件所在⽬录skip_name_resolve =1 # 只能⽤IP地址检查客户端的登录,不⽤主机名character-set-server = utf8mb4 # 数据库默认字符集,主流字符集⽀持⼀些特殊表情符号(特殊表情符占⽤4个字节)transaction_isolation =READ-COMMITTED # 事务隔离级别,默认为可重复读,MySQL默认可重复读级别collation-server = utf8mb4_general_ci # 数据库字符集对应⼀些排序等规则,注意要和character-set-server对应init_connect='SET NAMES utf8mb4' # 设置client连接mysql时的字符集,防⽌乱码lower_case_table_names =1 # 是否对sql语句⼤⼩写敏感,1表⽰不敏感max_connections =400 # 最⼤连接数max_connect_errors =1000 # 最⼤错误连接数explicit_defaults_for_timestamp = true # TIMESTAMP如果没有显⽰声明NOT NULL,允许NULL值max_allowed_packet = 128M # SQL数据包发送的⼤⼩,如果有BLOB对象建议修改成1Ginteractive_timeout =1800 # MySQL连接闲置超过⼀定时间后(单位:秒)将会被强⾏关闭wait_timeout =1800 # MySQL默认的wait_timeout值为8个⼩时, interactive_timeout参数需要同时配置才能⽣效tmp_table_size = 16M # 内部内存临时表的最⼤值,设置成128M;⽐如⼤数据量的group by ,order by时可能⽤到临时表;超过了这个值将写⼊磁盘,系统IO压⼒增⼤max_heap_table_size = 128M # 定义了⽤户可以创建的内存表(memory table)的⼤⼩query_cache_size =0 # 禁⽤mysql的缓存查询结果集功能;后期根据业务情况测试决定是否开启;⼤部分情况下关闭下⾯两项query_cache_type =0# ⽤户进程分配到的内存设置,每个session将会分配参数设置的内存⼤⼩read_buffer_size = 2M # MySQL读⼊缓冲区⼤⼩。

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

*****mysql依赖 MySQL 依赖 libaio,所以先要安装 libaioyum search libaio # 检索相关信息yum install libaio # 安装依赖包检查 MySQL 是否已安装yum list installed | grep mysql如果有,就先全部卸载,命令如下yum -y remove mysql-libs.x86_64下载 MySQL Yum Repositorywget /get/mysql-community-release-el7-5.noarch.rpm如果提示-bash: wget: 未找到命令,请先执行 yum install wget 安装 wget安装添加 MySQL Yum Repositoryyum localinstall mysql-community-release-el7-5.noarch.rpm[root@glpit01 software]# yum -y localinstallmysql-community-release-el7-5.noarch.rpmLoaded plugins: fastestmirror, langpacksExamining mysql-community-release-el7-5.noarch.rpm: mysql-community-release-el7-5.noarchMarking mysql-community-release-el7-5.noarch.rpm to be installedResolving Dependencies--> Running transaction check---> Package mysql-community-release.noarch 0:el7-5 will be installed--> Finished Dependency ResolutionDependencies Resolved============================================================================== ============Package Arch Version Repository Size============================================================================== ============Installing:mysql-community-release noarch el7-5/mysql-community-release-el7-5.noarch 4.3 kTransaction Summary==========================================================================================Install 1 PackageTotal size: 4.3 kInstalled size: 4.3 kDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transactionInstalling : mysql-community-release-el7-5.noarch 1/1Verifying : mysql-community-release-el7-5.noarch 1/1Installed:mysql-community-release.noarch 0:el7-5Complete!验证下是否添加成功yum repolist enabled | grep "mysql.*-community.*"[root@glpit01 software]# yum repolist enabled | grep"mysql.*-community.*"mysql-connectors-community/x86_64 MySQL Connectors Community30mysql-tools-community/x86_64 MySQL Tools Community43mysql56-community/x86_64 MySQL 5.6 Community Server306选择要启用 MySQL 版本(可以看到 5.5, 5.7 版本是默认禁用的,因为现在最新的稳定版是 5.6)yum repolist all | grep mysql[root@glpit01 software]# yum repolist all | grep mysqlmysql-connectors-community/x86_64 MySQL Connectors Communityenabled: 30mysql-connectors-community-source MySQL Connectors Community - Sodisabledmysql-tools-community/x86_64 MySQL Tools Communityenabled: 43mysql-tools-community-source MySQL Tools Community - Sourcedisabledmysql55-community/x86_64 MySQL 5.5 Community Serverdisabledmysql55-community-source MySQL 5.5 Community Server - Sodisabledmysql56-community/x86_64 MySQL 5.6 Community Server enabled: 306mysql56-community-source MySQL 5.6 Community Server - So disabledmysql57-community-dmr/x86_64 MySQL 5.7 Community Server Deve disabledmysql57-community-dmr-source MySQL 5.7 Community Server Deve disabled可以通过类似下面的语句来启动某些版本yum-config-manager --disable mysql56-communityyum-config-manager --enable mysql57-community-dmr或者通过修改 /etc/yum.repos.d/mysql-community.repo 文件# Enable to use MySQL 5.6[mysql56-community]name=MySQL 5.6 Community Serverbaseurl=/yum/mysql-5.6-community/el/7/$basearch/enabled=1gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql其中 enabled=0 是指禁用,enabled=1 指启用。

注意:任何时候,只能启用一个版本。

执行yum repolist enabled | grep mysql查看当前的启动的 MySQL 版本[root@bogon software]# yum repolist enabled | grep mysqlmysql-connectors-community/x86_64 MySQL Connectors Community 14mysql-tools-community/x86_64 MySQL Tools Community 17mysql56-community/x86_64 MySQL 5.6 Community Server 139通过 Yum 来安装 MySQL执行yum -y install mysql-community-server[root@glpit01 software]# yum -y install mysql-community-serverLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: * extras: * updates: Resolving Dependencies--> Running transaction check---> Package mysql-community-server.x86_64 0:5.6.35-2.el7 will be installed--> Processing Dependency: mysql-community-common(x86-64) = 5.6.35-2.el7 for package: mysql-community-server-5.6.35-2.el7.x86_64--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.35-2.el7.x86_64--> Processing Dependency: perl(DBI) for package:mysql-community-server-5.6.35-2.el7.x86_64--> Running transaction check---> Package mysql-community-client.x86_64 0:5.6.35-2.el7 will be installed--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.35-2.el7.x86_64---> Package mysql-community-common.x86_64 0:5.6.35-2.el7 will be installed---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64--> Running transaction check---> Package mariadb-libs.x86_64 1:5.5.40-1.el7_0 will be obsoleted---> Package mysql-community-libs.x86_64 0:5.6.35-2.el7 will be obsoleting---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch--> Running transaction check---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed--> Running transaction check---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved==========================================================================================Package Arch Version Repository Size==========================================================================================Installing:mysql-community-libs x86_64 5.6.35-2.el7 mysql56-community 2.0 Mreplacing mariadb-libs.x86_64 1:5.5.40-1.el7_0mysql-community-server x86_64 5.6.35-2.el7 mysql56-community 59 MInstalling for dependencies:mysql-community-client x86_64 5.6.35-2.el7 mysql56-community 19 Mmysql-community-common x86_64 5.6.35-2.el7 mysql56-community 257 kperl-Compress-Raw-Bzip2 x86_64 2.061-3.el7base 32 kperl-Compress-Raw-Zlib x86_64 1:2.061-4.el7base 57 kperl-DBI x86_64 1.627-4.el7base 802 kperl-IO-Compress noarch 2.061-2.el7base 260 kperl-Net-Daemon noarch 0.48-5.el7base 51 kperl-PlRPC noarch 0.2020-14.el7base 36 kTransaction Summary==========================================================================================Install 2 Packages (+8 Dependent packages)Total download size: 82 MDownloading packages:warning:/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.35-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPublic key for mysql-community-common-5.6.35-2.el7.x86_64.rpmis not installed(1/10): mysql-community-common-5.6.35-2.el7.x86_64.rpm| 257 kB 00:00:01(2/10): mysql-community-libs-5.6.35-2.el7.x86_64.rpm| 2.0 MB 00:00:04(3/10): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm| 32 kB 00:00:00(4/10): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm| 57 kB 00:00:00(5/10): perl-IO-Compress-2.061-2.el7.noarch.rpm| 260 kB 00:00:00(6/10): perl-Net-Daemon-0.48-5.el7.noarch.rpm| 51 kB 00:00:00(7/10): perl-PlRPC-0.2020-14.el7.noarch.rpm| 36 kB 00:00:00(8/10): perl-DBI-1.627-4.el7.x86_64.rpm| 802 kB 00:00:00(9/10): mysql-community-server-5.6.35-2.el7.x86_64.rpm| 59 MB 00:02:33(10/10): mysql-community-client-5.6.35-2.el7.x86_64.rpm| 19 MB 00:11:18------------------------------------------------------------------------------------------Total 124kB/s | 82 MB 00:11:18Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlImporting GPG key 0x5072E1F5:Userid : "MySQL Release Engineering<mysql-build@>"Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5Package : mysql-community-release-el7-5.noarch(@/mysql-community-release-el7-5.noarch)From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlRunning transaction checkRunning transaction testTransaction test succeededRunning transactionInstalling : mysql-community-common-5.6.35-2.el7.x86_64 1/11Installing : mysql-community-libs-5.6.35-2.el7.x86_64 2/11Installing : mysql-community-client-5.6.35-2.el7.x86_64 3/11Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 4/11Installing : perl-Net-Daemon-0.48-5.el7.noarch 5/11Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/11Installing : perl-IO-Compress-2.061-2.el7.noarch7/11Installing : perl-PlRPC-0.2020-14.el7.noarch 8/11Installing : perl-DBI-1.627-4.el7.x86_64 9/11Installing : mysql-community-server-5.6.35-2.el7.x86_64 10/11Erasing : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11Verifying : mysql-community-client-5.6.35-2.el7.x86_64 1/11Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 2/11Verifying : perl-Net-Daemon-0.48-5.el7.noarch 3/11Verifying : mysql-community-libs-5.6.35-2.el7.x86_64 4/11Verifying : mysql-community-common-5.6.35-2.el7.x86_64 5/11Verifying : perl-PlRPC-0.2020-14.el7.noarch 6/11Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 7/11Verifying : perl-DBI-1.627-4.el7.x86_64 8/11Verifying : perl-IO-Compress-2.061-2.el7.noarch 9/11Verifying : mysql-community-server-5.6.35-2.el7.x86_64 10/11Verifying : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11Installed:mysql-community-libs.x86_64 0:5.6.35-2.el7mysql-community-server.x86_64 0:5.6.35-2.el7Dependency Installed:mysql-community-client.x86_64 0:5.6.35-2.el7mysql-community-common.x86_64 0:5.6.35-2.el7perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7perl-DBI.x86_64 0:1.627-4.el7perl-IO-Compress.noarch 0:2.061-2.el7perl-Net-Daemon.noarch 0:0.48-5.el7perl-PlRPC.noarch 0:0.2020-14.el7Replaced:mariadb-libs.x86_64 1:5.5.40-1.el7_0Complete!执行rpm -qi mysql-community-server.x86_64 0:5.6.24-3.el7[root@glpit01 software]# rpm -qi mysql-community-server.x86_64 0:5.6.24-3.el7Name : mysql-community-serverVersion : 5.6.35Release : 2.el7Architecture: x86_64Install Date: Thu 09 Mar 2017 11:01:32 AM CSTGroup : Applications/DatabasesSize : 261997088License : Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field.Signature : DSA/SHA1, Tue 29 Nov 2016 02:47:43 PM CST, Key ID 8c718d3b5072e1f5Source RPM : mysql-community-5.6.35-2.el7.src.rpmBuild Date : Tue 29 Nov 2016 07:14:39 AM CSTBuild Host : Relocations : (not relocatable)Packager : MySQL Release Engineering<mysql-build@>Vendor : Oracle and/or its affiliatesURL : /Summary : A very fast and reliable SQL database serverDescription :The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,and robust SQL (Structured Query Language) database server. MySQL Serveris intended for mission-critical, heavy-load production systems as wellas for embedding into mass-deployed software. MySQL is a trademark ofOracle and/or its affiliatesThe MySQL software has Dual Licensing, which means you can use the MySQLsoftware free of charge under the GNU General Public License(/licenses/). You can also purchase commercial MySQLlicenses from Oracle and/or its affiliates if you do not wish to be bound by the terms ofthe GPL. See the chapter "Licensing and Support" in the manual forfurther info.The MySQL web site (/) provides the latest news andinformation about the MySQL software. Also please see the documentationand the manual for more information.This package includes the MySQL server binary as well as related utilitiesto run and administer a MySQL server.package 0:5.6.24-3.el7 is not installed执行whereis mysql可以看到 MySQL 的安装目录是 /usr/bin/启动MySQL服务[root@glpit01 software]# systemctl start mysqld开机启动[root@glpit01 software]# systemctl enable mysqld[root@glpit01 software]# systemctl daemon-reload5.6 直接输入mysql进入并设置访问规则mysql> set password for 'root'@'localhost'=password('Passw0rd');Query OK, 0 rows affected (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Passw0rd' WITH GRANT OPTION;Query OK, 0 rows affected (0.00 sec)mysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> select user,host from user;+------+-----------+| user | host |+------+-----------+| root | % || root | 127.0.0.1 || root | ::1 || | glpit01 || root | glpit01 || | localhost || root | localhost |+------+-----------+7 rows in set (0.00 sec)mysql> select user,host from user where host <> '%'; +------+-----------+| user | host |+------+-----------+| root | 127.0.0.1 || root | ::1 || | glpit01 || root | glpit01 || | localhost || root | localhost |+------+-----------+6 rows in set (0.00 sec)mysql> delete from user where host <> '%';Query OK, 6 rows affected (0.00 sec)mysql> select user,host from user;+------+------+| user | host |+------+------+| root | % |+------+------+1 row in set (0.00 sec)mysql>。

相关文档
最新文档