search
HomeDatabaseMysql Tutorialmysql免安装版配置步骤详解

mysql免安装版配置步骤详解

Jun 07, 2016 pm 04:18 PM
mysqlInstallstepDetailed explanationConfiguration

这篇文章主要介绍了mysql免安装版配置步骤详解,提供了二个网友的安装方法,大家可以参考使用 1.准备工作 下载mysql的最新免安装版本mysql-noinstall-5.1.53-win32.zip,解压缩到相关目录,如:d: mysql-noinstall-5.1.53-win32。这个就是mysql的根目录了。

 这篇文章主要介绍了mysql免安装版配置步骤详解,提供了二个网友的安装方法,大家可以参考使用

1.准备工作

 

下载mysql的最新免安装版本mysql-noinstall-5.1.53-win32.zip,解压缩到相关目录,如:d: mysql-noinstall-5.1.53-win32。这个就是mysql的根目录了。

 

2.配置

 

在根目录下有几个文件如下:

 

my-small.ini (这是针对一个小内存(〈= 64MB)的系统,MySQL 只会被时不时地用一下,很重要的是 mysqld 守护进程不会使用很多资源。)

my-medium.ini (这是针对一个小内存(32M- 64M)系统的,MySQL 扮演了一个比较重要的部分,或者当系统达到 128M 后 MySQL 被用来与其它程序(如一个 Web 服务器)一起使用。)

my-large.ini (这是针对一个内存 = 512M 的大系统,系统主要运行 MySQL)

my-huge.ini (这是针对一个内存为 1G – 2G 的大系统,,系统主要运行 MySQL)

my-innodb-heavy-4G.ini (这是一个针对 4G 内存系统(主要运行只有 InnoDB 表的 MySQL 并使用几个连接数执行复杂的查询)的 MySQL 配置文件例子)

对应自己的配置,自己选择下,其他的就删除吧。然后重命名成my.ini。编辑my.ini,在[mysqld]节点下增加如下几句:

basedir= D:/mysql-noinstall-5.1.53-win32 #根目录

datadir= D:/mysql-noinstall-5.1.53-win32/data #数据文件存放目录 

 

3.安装服务

 

cmd:进入mysql的根目录bin:

mysqld --install MySQL

这样用默认的 MySQL 为名称添加了一个windows服务。要移除mysql服务:

mysqld –remove MySQL

设置服务为自动启动:

sc config MySQL start= auto

 

4.启动与关闭

 

 

 代码如下:

cmd:

net start MySQL --启动

net stop MySQL --关闭 

 

 

mysql启动后。在任务管理器当中可以看到mysqld.exe这个进程。说明mysql已经安装好了。并且已经成功的启动!

 

5.精简:

 

如果你觉得mysql目录过于庞大的话请看。根目录下可以只留下my.ini和bin,data,share目录,其余全部删除。bin目录下可以把.pdb的文件全部删除。

 

6.初始化数据库:

 

由于mysql默认的root的密码为空并且只能本机登录,做如下修改:

cmd:进入mysql的根目录bin:

mysql -uroot

这时进入了mysql命令行界面,继续输入:

 

 

代码如下:

mysql

mysql

mysql

mysql

mysql

 

这样就给root用户赋予了初始密码"root",并且可以不限制本机登录。

 

7.乱码问题:

 

修改my.ini文件,找到[mysqld],在下方加上:

 

 

代码如下:

character-set-server = utf8 #mysql5.5开始

default-character-set = utf8 #mysql5.5以前

 

 

找到[client],在下方加上:

 

 

 代码如下:

default-character-set = utf8

 

 

另一网友提供的安装步骤和配置文件,大家可以参考二种方法

 

1.将下载好的 noinstall 包解压到你想放置的位置,这个位置放了就可以一直放那了!以后重装系统也不要紧。我这里是:E:/Program Files/mysql-5.1.58-win32/

 

2.新建一个my.ini文件。这个就是mysql的配置文件了,也可以从原来的ini改名,不过现在可以直接复制下面的配置:

 

 

 代码如下:

[client]

port=3306

 

[mysql]

default-character-set=gbk

 

[mysqld]

port=3306

basedir="E:/Program Files/mysql-5.1.58-win32/"

datadir="E:/MySQL Datafiles/"

default-character-set=gbk

default-storage-engine=INNODB

sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

max_connections=100

query_cache_size=15M

table_cache=256

tmp_table_size=18M

thread_cache_size=8

myisam_max_sort_file_size=100G

myisam_sort_buffer_size=35M

key_buffer_size=23M

read_buffer_size=64K

read_rnd_buffer_size=256K

sort_buffer_size=256K

innodb_data_home_dir="E:/MySQL Datafiles/"

innodb_additional_mem_pool_size=2M

innodb_flush_log_at_trx_commit=1

innodb_log_buffer_size=1M

innodb_buffer_pool_size=42M

innodb_log_file_size=10M

innodb_thread_concurrency=8

 

 

 

注意:这里需要修改的是 datadir 和 innodb_data_home_dir 这两个值,我一直是设置为同一个文件夹。 innodb_data_home_dir 就是INNODB 数据库储存引擎的数据地址。

 

3.用cmd进入mysql安装目录下的 bin 目录,再执行:

mysqld --install mysql --defaults-file="E:Program Filesmysql-5.1.58-win32my.ini"

就是注册为系统服务。 后面的默认配置文件就是上一步创建的文件的路径。

--install 后面跟的是 服务名称

出现:Service successfully installed. 则服务注册成功。

 

4.然后:

net start mysql

启动刚刚注册的 mysql 服务。

就ok了。如果想要删除这个服务。

就用:

mysqld --remove

这个命令是默认删除名为 mysql 的服务,如果不是这个名字,就在 remove 后加相应的服务名称。 

Statement
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
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

See all articles

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 Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools