MYSQL local installation and problem solving

MYSQL local installation and problem solving

Preface

This article is quite detailed and even a bit cumbersome. Many steps are omitted in other tutorial documents, but I still want to write it out because I took a lot of detours at the time, and I hope you can avoid them. Of course, if you know the answer, you can skip this and choose the part you want to know.

1. Download the installation package

Open the MySQL official website download page: http://dev.mysql.com/downloads/mysql/

Select the appropriate version and platform

Select the first one and click Download to enter the real download page. You will find that you need to log in to download. If you are careful, you will find that there is No thanks, just start my download. Just click this link.

Download and unzip to the corresponding directory, here it is all placed in D:\mysql

After decompression, rename the folder to mysql according to your preference. All mysql decompression files are in this directory: D:\mysql

2. MySQL configuration

Open the folder C:\wamp-all\mysql-5.7.13 that you just unzipped and find the my-default.ini configuration file in it. This is the default configuration file. Copy your own and rename it to my.ini

Edit my.ini and configure the following basic information:

[mysql]
# Set the default character set of the mysql client to default-character-set=utf8
 
[mysqld]
# Set port 3306 port = 3306
# Set the installation directory of mysql to basedir=D:\mysql
# Set the storage directory of mysql database data datadir=D:\mysql\sqldata
# Maximum number of connections allowed max_connections=20
# The default character set used by the server is the 8-bit latin1 character set character-set-server=utf8
# The default storage engine that will be used when creating a new table default-storage-engine=INNODB

3. Install and start MySQL

Open the cmd command line tool as an administrator and cd to the bin directory of the unzipped file: D:\mysql\bin

1. Enter mysqld install and press Enter to run. When the installation is successful, it will be OK.

2. Initialize mysqld --initialize-insecure to automatically generate a root user without a password. mysqld --initialize automatically generates a root user with a random password. Here, select a root user without a password.

3. Run net start mysql again to successfully start mysql

It may be that MySQL was installed before but not deleted or deleted completely, resulting in an incorrect installation directory in 1. If you want to query, you can execute sc query mysql in c:\windows\system32 to check the service named mysql: To delete, you can execute sc delete mysql in the current directory to delete mysql, and then continue to execute 1

4. Enter the MySQL environment

1. Go to the bin directory and execute mysql -uroot (no password required)

2. Create a new user and authorize him

create user 'test'@'localhost' identified by 'your password';
grant all privileges on . to test@'localhost';

Enter mysql -utest -p in the command line and press Enter, then enter the password you just set to enter.

If you want to exit the sql environment and return to the normal cmd environment, enter exit and press Enter. Enter mysql again and execute step 3.

5. Configure environment variables

Configure MYSQL_HOME=D:\mysql in the environment variables, and then add MYSQL_HOME/bin to Path

6. Connect to MySQL

It will appear when connecting

Solution:

1. Open the cmd command line window and enter the bin directory of MySQL.

Execute the command:

mysql -u root -p

Enter password:

2. Execute the following command: (change the password to 123456)

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; 

3. Refresh permissions and execute commands:

FLUSH PRIVILEGES; 

4. Connection successful:

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • MySQL installation diagram MySQL graphic installation tutorial (detailed instructions)
  • Installation and configuration of MySQL 5.6 under Windows with screenshots and detailed instructions
  • MySQL 5.6 (Win7 64-bit) download, installation and configuration graphic tutorial
  • MySQL 5.5 installation and configuration method graphic tutorial
  • CentOS 6.4 installation and configuration of LAMP server (Apache+PHP5+MySQL)
  • Install Apache and PHP under Linux; Apache+PHP+MySQL configuration strategy
  • Complete steps to install mysql5.7 on Mac (with pictures and text)
  • Graphic tutorial for installing mysql-5.6.4 under Linux
  • Summary of solutions for the problem that MySQL 5 cannot be started after installation (cannot start service)
  • Explain MySQL installation and login method under Linux

<<:  CentOS7 enables MySQL8 master-slave backup and daily scheduled full backup (recommended)

>>:  Vue implements the question answering function

Recommend

A detailed introduction to the basics of Linux scripting

Table of contents 1. Script vim environment 2. Ho...

js implements the algorithm for specifying the order and amount of red envelopes

This article shares the specific code of js to im...

VMware 15.5 version installation Windows_Server_2008_R2 system tutorial diagram

1. Create a new virtual machine from VMware 15.5 ...

404 error occurs when accessing the homepage of tomcat started in Docker mode

Scenario: When starting tomcat in docker (version...

Differences between Windows Server 2008R2, 2012, 2016, and 2019

Table of contents Common version introduction Com...

Notes on MySQL case sensitivity

Table of contents MySQL case sensitivity is contr...

js canvas realizes circular water animation

This article example shares the specific code of ...

Basic statements of MySQL data definition language DDL

MySQL DDL statements What is DDL, DML. DDL is dat...

Nginx operation and maintenance domain name verification method example

When configuring the interface domain name, each ...

How to use CocosCreator object pool

Table of contents Preface: Specific operations St...

MySQL Series 13 MySQL Replication

Table of contents 1. MySQL replication related co...