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

Install mysql under windows

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Step 1: download https://dev.mysql.com/downloads/mysql/ from the official website

Step 2: extract to a folder

Step 3: configure environment variables

Insert;% MYSQL_HOME%\ bin into the back of the Path

Step 4: run the command line as an administrator, press win+R to enter cmd, and click the right mouse button to run as an administrator

Step 5: enter E:\ mysql-5.7.22-winx64\ bin

Here's the point: enter mysqld-- initialize-insecure or mysqld-- initialize-insecure-- user=mysql in the dos window.

Note that in some tutorials, it is wrong to create an empty folder named data and then create a file called my.ini, because the self-built data folder does not have the table structure configuration file needed for mysql startup, so initialize first, enter the above command, and after initialization, you will find that there is an extra folder called data in the folder of mysql. Note that the data folder is created by the system. Did not create it manually, it takes a few seconds to run, dos

Initialization data:

After initialization, you will see the mysql table structure under the data folder:

Create a file for my.ini in the data directory generated after initialization:

[mysql]

# set mysql client default character set

Default-character-set=utf8

[mysqld]

# set port 3306

Port=3306

# set the installation directory of mysql

Basedir=E:\ mysql-5.7.22

# set the storage directory of the data in the mysql database

Basedir=E:\ mysql-5.7.22-winx64

Datadir=E:\ mysql-5.7.22-winx64\ data

# maximum number of connections allowed

Max_connections=200

# the character set used by the server defaults to the 8-bit encoded latin1 character set

Character-set-server=utf8

# default storage engine to be used when creating new tables

Default-storage-engine=INNODB

Enter: mysqld-install in the dos window (if it already exists, you can delete it using sc delete mysql or mysql-remove)

Service successfully installed is displayed:

Enter: net start mysql or: mysqld-- user=mysql # in the 5.dos window to start the mysql service

Or start from step 5% MYSQL_HOME%\ bin\ mysqld-- initialize-- user=mysql-- console

Step 6 Registration Service mysqld-install MySQL

Start the service with the net start mysql command

Shut down the service: net stop mysql

Delete useless services: sc delete service name for example: delete mysql's service, sc delete mysql

6. In computer-Administration-Services and applications-Services, you can see that MySQL has been started, or shortcut keys to view services.msc

7. Log in to the mysql database and skip the password during initialization, so there is no password by default. Enter enter to log in to the database.

8. Change password and authorization

Note:

Update mysql.user set authentication_string=password ('newpwd'), password_expired='N' where user='root'

Change the password and change the obsolete policy (the field name is slightly different from mysql 5.6,5.6: update user set password = password ('newpwd'), password_expired='N' where user =' root';)

Grant all on. To root@'%' identified by 'newpwd' with grant option

Flush privileges;# remember to refresh

9. Restart the mysql server and enter the correct password to log in to mysql

10. The default for viewing character encoding 5. 7 is ladin

11. Basic operation command

View the database and tables:

Show databases; / / list of all databases

Create database dbName; / / create a database

Use dbName; / / Select a database

Show tables; / / Show datasheet list

View the entries in the data table:

Desc tableName

Describe tableName

Show columns from tableName

Show create table tableName

Clear all entries in the data table:

Truncate table table name; / / clear all data, do not write log, non-recoverable, extremely fast

Delete from table name; / / clear all data, write log, data can be recovered, slow speed

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

Servers

Wechat

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

12
Report