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:
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
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!