首页 > 数据库 >windows 安装mysql

windows 安装mysql

时间:2023-08-22 17:13:50浏览次数:30  
标签:bin set windows MySQL server user mysql 安装

首先去下载Mysql文件

我下载的是zip版本的

 2.解压文件

3.在解压的文件主目录下创建一个my.ini文件

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# 设置mysql的安装目录
basedir = D:\\soft\mysql\mysql-5.7.29
# 设置mysql数据库的数据的存放目录
datadir = D:\\soft\mysql\mysql-5.7.29\data
# 设置3306端口
port = 3306
# server_id = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# 允许最大连接数
max_connections = 200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors = 10
# 服务端使用的字符集默认为UTF8
character-set-server = utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine = INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin = mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set = utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set = utf8mb4

  使用cmd进入解压出来的bin目录

cd C:\MySQL\mysql-8.1.0-winx64\Install\bin

  初始话数据库

mysqld --initialize --console

  这里会有一段话@localhost:xxxxx

  这个xxxxx就是默认的初始密码,记得保存下来。

  运行安装服务 

mysqld.exe -install
C:\MySQL\mysql-8.1.0-winx64\Install\bin>mysqld.exe -install

  提示

Service successfully installed.

 说明服务安装成功

    再运行

net start mysql
C:\MySQL\mysql-8.1.0-winx64\Install\bin>net start mysql

 服务启动成功,

 

 到目前为止都安装完了

但是目前只能通过localhost也就是本机登录

继续cmd管理员模式进入安装目录的bin文件下

登录mysql

mysql -u root -p

输入刚刚保存的密码(这里只能手打不能粘贴)

选择“mysql”数据库

use mysql;

更新“user”表中root账号的host项

update user set host='%' where user='root';

刷新权限

flush privileges;

查看是否修改成功

select host,user from user where user='root';

完成!

修改登录密码(需要先登录)

alter user'root'@'localhost' identified with mysql_native_password by '你的密码';

标签:bin,set,windows,MySQL,server,user,mysql,安装
From: https://www.cnblogs.com/xiaosongboke/p/17648969.html

相关文章

  • windows 桌面GUI自动化-6. pywinauto 操作弹出新窗口上按钮
    前言pywinauto操作弹出新窗口上的按钮操作新窗口frompywinautoimportApplicationapp=Application('uia').start("notepad.exe")win=app.window(title_re="无标题-记事本")#操作级联菜单win.menu_select('帮助(H)->关于记事本(A)')点关于后弹出新窗口,现在......
  • openssh 编译安装 封装rpm
    tar-zxfopenssl-1.1.0k.tar.gzyum-yinstallwgetpam*yuminstall-yperlrpm-buildgccgcc-c+iglibcglibc-developenss1-developensslprcepcre-develzlibzlib-develcd/root/openssh/openssl-1.1.1v./config--prefix=/openssh9.4p1--openssldir=/open......
  • 使用docker-compose安装Milvus向量数据库及Attu可视化连接工具
    服务器需要安装docker-compose如何没有安装可以参考这篇博客https://www.cnblogs.com/likecoke/p/17596918.html1、创建宿主机上存储的目录mkdir-p/home/milvus/dbmkdir-p/home/milvus/confmkdir-p/home/milvus/etcd2、下载milvus官网的docker-compose.yml文件wgethtt......
  • SolidWorks 2017三维机械设计软下载和安装教程
    Solidworks是一款功能强大的三维机械设计软件系统,有功能强大、易学易用和技术创新三大特点,这使得SolidWorks成为领先的、主流的三维CAD解决方案。自1995年问世以来,以其优异的性能、易用性和创新性,极大地提高了机械工程师的设计效率,在与同类软件的激烈竞争中已经确立其市场地位,成为......
  • SQL注入-sqlmap的安装
    一、Sqlmap简介sqlmap是一个自动化的sql注入工具,其主要功能是扫描,发现并利用给定的URL进行sql注入,目前支持数据库有mysql、oracle、access、postagesql、sqlserver、sqlite等二、SQLMap下载下载官网:https://sqlmap.org/三、SQLMap安装注:因为sqlmap基于Python语言开发的,所以......
  • kylin操作系统安装mysql
    首先坑的是麒麟说自己基于ubuntu。结果包管理工具用的yum。然后yum包里还没有mysql只能自己下载安装。1.第一种方式直接下MySQL::DownloadMySQLCommunityServer(ArchivedVersions) 里装好的mysql的tar包,然后解压。解压以后拷贝到/usr/local/mysql目录下注意如果在别的目......
  • Mac:安装sqlserver
    0.macm2cpu安装sqlserver1.基本步骤,安装docker->拉取镜像->安装镜像->设置强密码->查看是否成功->ok2.sqlserver镜像2017-2022都不能在m2cpu上运行。只能拉azure镜像3.安装docker(https://www.docker.com/)安装官网步骤就行了。4.安装azuresql(https://learn.microsoft.com/......
  • docker 内apt-get安装软件都不好使
    报各种错误apt-getinstall--no-install-recommendslibboost-all-devReadingpackagelists...DoneBuildingdependencytreeReadingstateinformation...DoneThefollowingadditionalpackageswillbeinstalled:autoconfautomakeautotools-devcpp-8gc......
  • 14 神奇的windows
    14神奇的windowswindow对象是一个很神奇的东西.你可以把这东西理解成javascript的全局.如果我们默认不用任何东西访问一个标识符.那么默认认为是在用window对象.例如:eval===window.eval//truesetInterval===window.setInterval//truevara=10;a===win......
  • 基于JAVA+MySQL技术智能服装推荐系统的设计与实现-计算机毕业设计源码+LW文档
    1.开题依据1.1研究的目的意义在过去到现在,消费方式从物物交换到以通俗认知中的“货币”购买物品,再到如今的网上支付交易,实物物流运输到达我们的手上。购物方式从实体店的消费模式,转到了网上店铺的交易。相信很多人在现实生活中都有过实体店购物的消费的体验,在实体店消费需要安排......