MySQL is a mature relational database management system that is often used for website development and data management. Normally, we need to install MySQL in our computer to use it. But today we will introduce a MySQL method that does not require installation-the installation-free version.
Installation-free version of MySQL means that we do not need to install the MySQL software on the computer, but directly use the command line tool to access the MySQL database. The advantage of this method that does not require installation is that you can easily use MySQL on different computers without having to install it on a new computer every time.
First, we need to download the installation-free version of MySQL. We can find the download page for the installation-free version of MySQL on the official MySQL website.
On this page, we can choose different versions and operating systems to download the installation-free version of MySQL that suits us.
In this article, we use the Windows operating system and downloaded the latest version of MySQL 8.0.23 installation-free version.
After the download is completed, unzip the compressed package and place the decompressed folder in the root directory of the C drive:
C:mysql-8.0.23-winx64
Next, we Some configuration is required to use the installation-free version of MySQL.
First, copy the my-default.ini
file under the C:mysql-8.0.23-winx64
path copy and name it my.ini
.
Then, find the following content in my.ini
and modify it:
[mysqld] #设置字符集 character_set_server=utf8mb4 [client] default-character-set=utf8mb4
Here, we set the character set of MySQL to utf8mb4
, to support multiple languages.
Next, we need to add the path to MySQL in the environment variable. Open the computer's environment variable settings, find the Path
variable, and add the path to MySQL:
C:mysql-8.0.23-winx64in
Before we use the installation-free version of MySQL for the first time, An initialization operation is required, which creates the MySQL system database and related files. Execute the following command in the command line:
mysqld --initialize-insecure --user=mysql
At this time, the system database and related files will be created in the C:mysql-8.0.23-winx64data
directory.
After the initialization is completed, we can start the MySQL service. Execute the following command in the command line:
mysqld --console
At this time, the MySQL service will be started.
After starting MySQL, we can use the MySQL client to access the database.
Execute the following command in the command line to log in to MySQL using the default super administrator account (user name is root, password is empty):
mysql -u root -p
This will ask you to enter your password, but because We did not set a super administrator password, so just press Enter.
Now that we have successfully logged in to the MySQL server, we can execute various SQL statements to manage and query the database.
This is how to use the installation-free version of MySQL. It is especially suitable for situations where MySQL needs to be used quickly on different computers. If you don't want to install MySQL on your computer or don't want to leave any traces on your computer, then MySQL Installation Free can provide a very good solution.
The above is the detailed content of mysql installation-free configuration. For more information, please follow other related articles on the PHP Chinese website!