Home > Database > Mysql Tutorial > How to configure the installation-free version of MySQL

How to configure the installation-free version of MySQL

PHPz
Release: 2023-04-20 11:34:55
Original
884 people have browsed it

MySQL is a relational database management system that is widely used in background data management of web applications. When doing application development or testing, we often need to run a MySQL server in a local environment. MySQL officially provides an executable program installation package, but in some cases, we may need to use the installation-free version of MySQL server. This article will introduce you how to configure the installation-free version of MySQL.

Step 1: Download MySQL installation-free version

First, you need to download the portable version of MySQL server. You can download the file for your operating system from the MySQL official website. Once downloaded, you can unzip the file to any location you like. Note that these versions do not include the MySQL GUI tools or installer, you will need to configure and start the server manually.

Step 2: Create the data directory

Let’s start setting up the server. In the root directory of the MySQL server, we need to create a data directory to save MySQL data. Within the data directory, you can create subdirectories to house different databases. For example, to create a data directory named "test", follow these steps:

  1. Create a directory named "data" under the MySQL Server root directory, which will be used for Stores all MySQL data.
  2. Create a my.ini file in the root directory of MySQL Server. This is the configuration file of the MySQL server.

In this file, we need to set the location of the MySQL data directory. To do this, add the following line:

[mysqld]

datadir=C:/MySQL Server/data

  1. Double-click the directory data and create it under the name test folder.

In this way, you can see a database named test in the MySQL server.

Step Three: Configure MySQL Server

Next, we need to configure the MySQL server so that it can run on the local computer. In the my.ini file, we need to add the following:

[mysqld]

port=3306

default-character-set=utf8

default-storage-engine=INNODB

skip-name-resolve

You can adjust the port number and character encoding as needed. Note that name resolution is skipped, which will make the MySQL server run faster.

Step 4: Start the MySQL server

The next step is to start the MySQL service. For the installation-free version, starting the MySQL server is very simple. Just enter the MySQL bin folder in CMD, enter cmd in the address bar of the folder path, and then enter the following command after the bin folder path to successfully start the MySQL server:

mysqld -- console

You can enable remote access in the my.ini file so that your application can access the MySQL server from a remote computer.

Step 5: Connect to the MySQL server

Now, the MySQL server is ready and you can use the MySQL client to connect to it. We recommend using MySQL client command operations. You can find the MySQL client in the bin directory and use the following command to log in to the MySQL server:

mysql -u root -p

In the above command, "root" is the user name, system You will be prompted for your password. If your MySQL server does not set a password, you can press Enter to skip the password.

Finally, you can use the following command to create a new database:

create database test;

Now that you have successfully configured the installation-free MySQL server, start using it. !

The above is the detailed content of How to configure the installation-free version of MySQL. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template