Home Database Mysql Tutorial mysql免安装版配置步骤详解

mysql免安装版配置步骤详解

Jun 07, 2016 pm 04:18 PM
mysql Install step Detailed explanation Configuration

这篇文章主要介绍了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 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 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)

How to open phpmyadmin How to open phpmyadmin Apr 10, 2025 pm 10:51 PM

You can open phpMyAdmin through the following steps: 1. Log in to the website control panel; 2. Find and click the phpMyAdmin icon; 3. Enter MySQL credentials; 4. Click "Login".

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

How to use single threaded redis How to use single threaded redis Apr 10, 2025 pm 07:12 PM

Redis uses a single threaded architecture to provide high performance, simplicity, and consistency. It utilizes I/O multiplexing, event loops, non-blocking I/O, and shared memory to improve concurrency, but with limitations of concurrency limitations, single point of failure, and unsuitable for write-intensive workloads.

MySQL's Place: Databases and Programming MySQL's Place: Databases and Programming Apr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Centos install mysql Centos install mysql Apr 14, 2025 pm 08:09 PM

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

See all articles