Home Operation and Maintenance Windows Operation and Maintenance A detailed introduction on how to configure the startup surface installation version of mysql under Windows

A detailed introduction on how to configure the startup surface installation version of mysql under Windows

Jun 07, 2017 am 09:26 AM

一,下载Zip版本的免安装版本的Mysql,并解压之安装目录下面

二,在Windows的Path中添加Mysql的Bin目录,使得可访问mysql等命令。

*遇到奇怪问题,在win10的path加入了mysql运行记录。但是执行mysql依然未找到。此时mysql的bin目录为path中的最后一项。后来在path中再增加一项(例如,path为 ....;%MYSQL_BIN%;D:\test;)则可以在命令中可以找到mysql

三,创建Mysql的启动选项文件my.ini。

Mysql会从C:、 Windir,安装目录等多个目录搜索My.ini配置文件。mysql5.7.1.17没有启动用的配置文件,同时没有设置Data文件夹。可以在安装目录或者希望存放数据的地方创建data目录

创建My.ini文件,并且设置配置如下

[client]
#客户端使用UTF8
default-character-set=utf8
[mysqld]
#服务启动的目录
#注意Windows下面,目录路径分隔符要用/,如要要用反斜杠,则要\\
basedir=D:/Server/mysql-5.7.18-winx64
datadir=D:/Server/mysql-5.7.18-winx64/data
port = 3306
#服务器默认使用UTF8
character-set-server=utf8
#不使用授权表可以登陆MYSQL,初次启动适用
skip-grant-tables
Copy after login

四,调用初始化命令,初始化。该命令需要用管理员权限运行。

win10在开始菜单的视窗图标 右键 -> 命令提示符(管理员) 可以打开

mysqld --initialize
\mysqld --initialize-insecure #这个命令,代表初始化后,root用户为空密码
** 同时可以制定初始化时候使用的配置文件
mysqld --defaults-file=C:\my.ini --initialize
Copy after login

执行该命令后,MYSQL将进行data数据存放目录的初始化,以及数据库原始表的一些初始化工作,包括root用户的创建。

在data(数据目录)目录下面的XXXXXX.err文件里面,可以查看生成的root的随机密码

五,启动mysql服务

mysqld --console
Copy after login

五,登陆并修改密码

如果忘记密码了,可以从MySql的error log里面找到初始化的随机密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abcd8888';
Copy after login

The above is the detailed content of A detailed introduction on how to configure the startup surface installation version of mysql under Windows. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

Compare and contrast MySQL and MariaDB. Compare and contrast MySQL and MariaDB. Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

MySQL: The Database, phpMyAdmin: The Management Interface MySQL: The Database, phpMyAdmin: The Management Interface Apr 29, 2025 am 12:44 AM

MySQL and phpMyAdmin can be effectively managed through the following steps: 1. Create and delete database: Just click in phpMyAdmin to complete. 2. Manage tables: You can create tables, modify structures, and add indexes. 3. Data operation: Supports inserting, updating, deleting data and executing SQL queries. 4. Import and export data: Supports SQL, CSV, XML and other formats. 5. Optimization and monitoring: Use the OPTIMIZETABLE command to optimize tables and use query analyzers and monitoring tools to solve performance problems.

How to handle high DPI display in C? How to handle high DPI display in C? Apr 28, 2025 pm 09:57 PM

Handling high DPI display in C can be achieved through the following steps: 1) Understand DPI and scaling, use the operating system API to obtain DPI information and adjust the graphics output; 2) Handle cross-platform compatibility, use cross-platform graphics libraries such as SDL or Qt; 3) Perform performance optimization, improve performance through cache, hardware acceleration, and dynamic adjustment of the details level; 4) Solve common problems, such as blurred text and interface elements are too small, and solve by correctly applying DPI scaling.

Steps to add and delete fields to MySQL tables Steps to add and delete fields to MySQL tables Apr 29, 2025 pm 04:15 PM

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

How to uninstall MySQL and clean residual files How to uninstall MySQL and clean residual files Apr 29, 2025 pm 04:03 PM

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

An efficient way to batch insert data in MySQL An efficient way to batch insert data in MySQL Apr 29, 2025 pm 04:18 PM

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

How to use MySQL functions for data processing and calculation How to use MySQL functions for data processing and calculation Apr 29, 2025 pm 04:21 PM

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

See all articles