Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure MySQL database

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to install and configure MySQL database". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

MySQL is a popular relational database. Although it does not perform as well as oracle, it has a community version, which does not require an oracle license to use it (MySQL is now owned by oracle), so many small web sites choose to use it.

download

Go to the MySQL official website to download.

Decompression configuration

Unzip the downloaded package to a folder with no Chinese and no spaces (Xiaobian puts it directly under the F drive letter).

Add the bin folder under the extracted folder to the environment variable (path variable)

Initialize the data folder

The downloaded MySQL (after version 5.7) does not have a data folder by default, so we need to create a data folder.

Run the command prompt (or powershell) with administrator privileges to run the following instructions:

Mysqld-initialize-insecure-user=mysql

After executing the above command, MySQL creates a data folder and sets up the default database.

The login user name is root and the password is empty. You can then start the mysql service with the command net start mysql.

Note: be sure to use an administrator to run it, otherwise there will be errors such as access denied.

Install the mysql service

Or enter: mysqld-install under the command line bin directory

Database configuration

Version 8.0 does not need to configure my.ini (my-default.ini), but the lower version needs to be configured (higher versions of the database can also add this file to modify the database configuration).

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html# * * DO NOT EDIT THIS FILE. It's a template which will be copied to the# * * default location during install, and will be replaced if you# * * upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# These are commonly set, remove the # and set as required.# basedir = .# datadir = .# port = .# server_id = .# Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed Experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2m sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

The lower version requires two properties to be configured

Remove the previous comment symbol "#" and enter the correct value according to your installation directory.

Here basedir is your mysql unzipped directory, and datadir is your database data storage directory. It is usually placed in the data directory under the root directory.

In my configuration, for example, I unzipped the folder to F:\ mysql-8.0.25-winx64, so basedir is F:\ mysql-8.0.25-winx64, while according to custom (some developers like to configure the data folder somewhere else), datadir is F:\ mysql-8.0.25-winx64\ data.

This is the end of "how to install and configure MySQL database". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report