Home > Database > Mysql Tutorial > body text

Installation graphic tutorial for MySQL green version (zip decompression version) (mysql-5.6.22-win32.zip)_MySQL

WBOY
Release: 2016-07-06 13:32:46
Original
1143 people have browsed it

1. Database download

Mysql official website: http://www.mysql.com/, database download address: http://www.mysql.com/downloads/. Two types of file packages can be found from the official website, one is the exe installation program and the other is the zip compressed package. I like the refreshing way, so I downloaded the ZIP compressed package. The latest 5.6.22 is about 350M. You need an Oracle account to download. You can register one yourself.

2. Database installation

Unzip the downloaded file mysql-5.6.22-win32.zip (there are two versions: x86 and x64) to any directory to prevent unknown problems. It is best to put it in a non-Chinese directory on the non-system disk. I The location is C:Program Filesmysql-5.6.22-win32. Open the folder and copy a copy of my-default.ini to the configuration file my.ini.

Open the my.ini file and modify the relevant configuration as follows

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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.
#mysql根目录
 basedir ="C:\Program Files\mysql-5.6.22-win32"
#数据文件存放目录
 datadir ="C:\Program Files\mysql-5.6.22-win32\data"
# port = .....  端口,默认3306
# 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 
#服务端的编码方式
character-set-server=utf8
[client]
#客户端编码方式,最好和服务端保存一致
loose-default-character-set = utf8

[WinMySQLadmin] 
Server = "C:\Program Files\mysql-5.6.22-win32\bin\mysqld.exe"
Copy after login

If you need a more optimized my.ini configuration file, you can refer to this article: http://www.bitsCN.com/article/84357.htm

The above settings are to ensure the normal operation of the service. Adjust the parameters according to your needs and restart the service after modification.

3. Register Mysql service

Start - Run - cmd, then cd to the bin of the mysql installation directory. My directory is "C:Program Filesmysql-5.6.22-win32bin", then execute mysqld -install, it will prompt that the service installation is successful! Run services.msc to see that there is indeed a service named MySQL. Start it. Sometimes the startup fails, just adjust the parameters according to the situation.
Even if the mysql installation is completed here, it is actually quite simple. However, if you have not done it before, the whole process will probably take a lot of time, and it is also a necessary process for growth.

4. Log in and maintain Mysql

The installation was successful and started. How do I log in? What is the username and password?

The default username of MySQL is root and the password is empty.

How to log in? Or start - run - cmd, cd to the bin directory, and then execute "mysql -u root -p", you will be prompted to enter the password. Since it is the first time to run, the password is empty and you can press enter directly.

Let’s set a password for the database. Enter exit to log out. Then run C:Program Filesmysql-5.6.22-win32binmysqladmin -uroot -p password , replace with your custom password, and press Enter. At this time, you will be prompted to enter a password, which actually refers to the original password. Because the original password is empty, press Enter here to complete the setting. Then use the above method and new password to log in to mysql, and it will work normally.

Run "show variables like '%version%'" to view database related information

 

At this point, the installation of the entire database is completed.

Although the mysql client can complete all database operations, the black command line interface still scares many people away, and the learning curve has skyrocketed. I would like to recommend a tool Navicate for mysql to everyone. I personally feel that it is very easy to use. The operations are clear at a glance, and SQLyog is also good.

 

5. Enable remote login

After the mysql installation is completed, by default you can only log in to the local machine (that is, localhost). We need to enable remote login for easy use. There are many ways to enable it, including Baidu. Let me talk about the method to pass the test

x:\>mysql -u root -p 密码  //登录系统
mysql> use mysql;    //切换数据库
mysql> update user set host = '%' where user = 'root'; 
//上面这句话有时出现一个错误 ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'

//不过这时你查询一下user表发现已经更新一条记录了,下面这句话
mysql> select host, user from user;

//直接执行这句,其实就是刷新权限
mysql> flush privileges;
Copy after login

Try to test the remote connection again, it works now

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template