Installing and running mysql windows. Launch MySQL Workbench and connect to the MySQL server. Download your copy

Last update: 19.12.2017

MySQL is not an integral component for creating PHP websites. We can use various systems databases, but today MySQL is the most popular system database management for working with PHP, in addition, it is free.

To install MySQL, download the distribution kit from http://dev.mysql.com/downloads/mysql/ and select the desired version.

For example, I have a 64-bit Windows version so I chose the package Windows (x86, 64-bit), MySQL Installer MSI. After selecting the version, download the installation package.

On the page for Windows OS there are two types of installer, you can choose any one.

After downloading, run the installer.

If any version of MySQL is already installed on the system, then instead of installation it will be offered to update individual components.

After acceptance license agreement You will be prompted to select an installation type. Let's select the Developer Default type:

IN in this case The installer shows that I do not have Excel 2010 and Python installed. Since these components are not important, click Next.

Then, during the installation phase, the installer will display the entire list of installed components. For me it looks like this:

To install all components, click the Execute button.

After all components are installed, click Next.

Then, in the next window of the installation program, we will indicate a password and remember it, since it will later be required when connecting to the MySQL server:

The next set of configurations, which we will also leave as default, indicates that the server will be launched as Windows services when starting the operating system:

The next window allows you to configure additional plugins and extensions. Since version 5.7, MySQL has made available the X Protocol, which introduces a new way to interact with data storage. This option does not need to be checked. In this case I will mark it:

And on the next screen you need to apply all previously installed configuration settings by clicking on the Execute button:

After this, the installation will be completed. A notification about server startup will appear in the tray.

You can simply click through all subsequent configuration windows and leave all the default values. At the very end, the following window may be displayed, where you will need to click on the Finish button:

After this installation and configuration MySQL server will be finally completed and we can use the server to access the databases.

For Win 32, select the distribution: Windows (x86, 32-bit), Zip-Archive.

For Win 64: Windows (x86, 64-bit), Zip-Archive.

After clicking on the Download button you will see a registration form, you can skip it by clicking on the link below - No thanks, just take me to the downloads.

2. Create an installation folder. For example . And unpack the contents of the archive into it so that the folders bin, data, docs and others were in the root of the installation folder.

3. Let's move on to creation configuration file(my.ini). We take one of the standard files as a basis:

  • my-small.ini - suitable for those who use MySQL from time to time and do not want the server to take up a lot of resources.
  • my-medium.ini is also not a resource-demanding configuration, but is suitable for those who use MySQL on permanent basis (a good choice for home web server).
  • my-large.ini and my-huge.ini - for systems used as a dedicated MySQL server. However, my-large.ini can be used for home server, if needed extra performance MySQL (512 MB random access memory not so much in modern times).
  • my-innodb-heavy-4G - for dedicated servers with at least 4 GB of RAM and using only InnoDB tables.

In this example, I chose my-medium.ini as the basis. Rename it to my.ini and place it in the root of the installation folder ( C:\Program Files\MySQL\ MySQL Server 5.5 ).

Open for editing (in regular Notepad) and immediately after the line add two parameters:

Basedir=C:/Program Files/MySQL/MySQL Server 5.5 datadir=C:/Program Files/MySQL/MySQL Server 5.5/data

Note that paths use forward slash (/) rather than backslash (\).

basedir is the path to the installation folder.

datadir - path to the data folder (where all databases are stored). Sometimes it makes sense to put data on a separate disk to improve performance or ensure reliability.

Just in case, here is a fragment of the configuration file after making the changes:

# The MySQL server basedir=C:/Program Files/MySQL/MySQL Server 5.5 datadir=C:/Program Files/MySQL/MySQL Server 5.5/data port = 3306 socket = /tmp/mysql.sock skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M

4. The next step is to add the path C:\Program Files\MySQL\MySQL Server 5.5\bin to your PATH environment variable to make it easier to start MySQL from command line. To do this, open System Properties -> Extra options systems -> on the Additional tab at the very bottom, the button “ Environment Variables..." In the window that opens, scroll through the system variables until we find Path. Select this line and click “Change...”. At the end of the line we add our path, preserving the existing parameters:

Note that paths are separated by semicolons. Make sure there is a semicolon at the beginning and end of your path.

5. Before performing a test run, open the incoming TCP port 3306 in Windows Firewall:

If the system has additional firewall, then it also needs to open TCP port 3306 for incoming connections.

6. Now we carry out a test run. In the command line launched as administrator (this is required if UAC is enabled on Seven or Vista), run:

mysqld --console

Several lines will be displayed on the screen. If the launch was successful, then last line will look something like this:

Version: "5.5.9-log" socket: "" port: 3306 MySQL Community Server (GPL)

Leave this window open, and open another command line window, in which we enter:

Mysql -u root

If the connection was successful, you will see a command prompt: mysql>

Let's see what databases we have:

Show databases;

The semicolon at the end of the SQL query is MANDATORY!

Team response:

Now we are finally convinced that the server is working.

7. Let's move on to the next step - you need to set the MySQL administrator password (root user). There is no password set by default, and this needs to be fixed. In the same MySQL window, enter the following commands:

Use mysql UPDATE user SET password = PASSWORD("yourpassword") WHERE user = "root";

Let's check the result:

SELECT user, host, password FROM user;

As you can see in the screenshot, the password column is filled, which means the password has been set.

Before exiting, run the command:

FLUSH PRIVILEGES;

Now, when connecting, you must enter a password. To do this, use the -p switch:

Mysql -u root -p

To shutdown MySQL run:

Mysqladmin -u root -p shutdown

8. Final stage- launch MySQL as system service Windows.

Make sure there is no active processes MySQL.

In the command line running as administrator, run:

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install

The path to mysqld must be specified in full (even if it is listed in PATH)!

To start the service, open “Computer Management” and manually start the MySQL service:

Or easier via the command line:

Net start mysql

To remove a service, first stop it:

Net stop mysql

and execute:

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --remove

Download the self-extracting archive “Windows (x86, 32-bit), MSI Installer" and run it.

Installing MySQL in pictures

Click on the selective installation of “Custom” components in this window.

Now let's get started MySQL setup server.

Select the detailed setting - “Detailed Configuration”.

Check the “Developer Machine” item. We are developers, right? 🙂

By selecting the “Multifunctional Database” item, you can work with both InnoDB type tables (with the ability to use transactions) and high-speed MyISAM (as a rule, this type of table is used for web development).

Selecting a disk and directory for storing InnoDB tables.

In this dialog box, you select the maximum possible number of connections to the MySQL server. When selecting "Decision Support (DSS)/OLAP", maximum amount connections will be limited to twenty, which is more than enough when installing the server on home computer and lack large quantities simultaneous connections.

By checking “Enable TCP/IP Networking” we enable support for TCP/IP connections and select the port through which they will be made. The standard port for the MySQL server is 3306. By checking “Enable Strict Mode”, we set the strict compliance mode SQL standard (this option It is recommended to leave it on).

Pay attention to the settings in this window. By checking “Manual Selected Default Character Set / Collation” and selecting “cp1251” from the drop-down menu, we determine that initially the Cyrillic Windows encoding (cp1251) will be used for the tables, which means correct operation with the Russian language in this encoding.

If you check “Install As Windows Service", the server will start as a service, which is the recommended way to start it. Below, in the drop-down list, specify the name of the service. Next, uncheck the box next to “Launch the MySQL Server automatically” - we will launch the server manually. Also check the box next to “Include Bin Directory in Windows PATH” - this will set the visibility of the “bin” directory for the command line.

Set the user password to "root". I advise you to do this. Enter at least some simple password, just don’t leave the field empty, this will save you from possible troubles in the future.

Open the “my.ini” file for editing.

  1. In the section, after the line:
    port=3306
    Add a line defining the directory containing encoding description files:
  2. In the section, after the line:
    port=3306
    Add the following two lines, the first of which you already know, the second sets the encoding in which the data is transmitted to MySQL:
    character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.5/share/charsets"
    init-connect=”SET NAMES cp1251″
  3. Next, find the line:
    default-storage-engine=INNODB
    Replace the initially installed table type with MYISAM:
    default-storage-engine=MYISAM

Save your changes and close the "my.ini" file.
Installation and configuration of the MySQL server is completed.

Original article http://php-myadmin.ru/learning/instrument-mysql.html

Today we will take a closer look at the installation process MySQL DBMS version 5.6.23 to the operating room Windows system 7, in addition to this, we will also install the MySQL Workbench 6.2.4 development and administration tool.

Several years ago, we already looked at installing MySQL using version 5.5 as an example, but time is running, technologies are developing, new versions are being released, so now is the time to update your knowledge in the field of MySQL, and specifically in installing this DBMS. And since this site is for beginners, we will consider installing on operating system Windows 7 with step by step description the whole process. This material will also be useful for novice database programmers who want to practice writing queries in SQL or just get to know the database server better. MySQL data. Moreover, the installation process described below will include not only the installation of the server itself, but also the MySQL Workbench developer tool, the Excel plugin “MySQL for Excel”, MySQL Connectors, as well as examples and documentation.

Since in the last article we already touched upon the question of what MySQL actually is, so today we will not focus on this, but will immediately move on to the topic of the material, i.e. installation process and we will start, of course, with where we can get the MySQL distribution for Windows.

Where can I download the latest version of MySQL for Windows?

And since we will be installing on Windows 7, it is best to download MySQL Installer ( installer, distribution) which, as we noted above, will include not only the MySQL server but also much more. In order to download, the installer must go to official page downloads, here it is, since it is recommended to download only from official sources, this, by the way, applies not only to MySQL but to all software.

After you have navigated to the page at the bottom you will find the block “ MySQL Installer 5.6.23" and press " Download»

Finally the installer package will download Windows file mysql-installer-community-5.6.23.0.msi 282.4 megabytes in size.

Installing MySQL 5.6.23 on Windows 7

Now let's proceed to the installation, to do this we run the downloaded file ( installer). But if suddenly you get an error during startup, i.e. window with the following content

then this means that you do not have Microsoft .NET Framework installed the required version, since for the operation of all components included in the this installer minimum client required Microsoft profile.NET Framework 4, what it is and how to install it, we talked in detail in the material about installing Microsoft .NET Framework 4.0. Also, for the MySQL Workbench program to work, you must Microsoft Visual C++ Redistributable for Visual Studio 2013 , so you need to install it too. By the way, if you do not know what is installed on your system and what is not, do not worry, during the installation process the installer will check your system for the presence of the necessary external components, which are needed for the operation of each of the selected MySQL products, and will display a list of them, and if necessary, you can quickly install them ( We'll touch on this a little further below.).

Note! Installer languageEnglish tJust like the MySQL Workbench program interface.

Step 1

We agree to the terms of the license agreement by checking the appropriate box and clicking “ Next»

Step 2

Then we mark what we want to install, and since we decided to install everything that a novice developer needs, we select the default installation type, i.e. " Developer Default" and click " Next»

Step 3

Next, the installer will check your system for necessary components, You in turn need to install these components ( those. select them and click “Execute”) or click " Next"but in this case the corresponding components will not work. But, for example, if you don’t need these components, let’s say you don’t use Visual Studio, so you don’t need to install the component. For example, I do not have it installed on this test computer. Microsoft Office and Visual Studio, so in this case I will not install the listed components, click “ Next».

A small warning related to the absence of some components, click " Yes»

Step 4

Then the installer will tell us what exactly he will install, we click " Execute»

And so the installation began

After installing all components, the “ Next"We press it

Step 5

Step 6

And since we are just beginners on the first window, I suggest leaving everything by default, i.e. do not change anything, but immediately press “ Next»

Step 7

On the next window you need to create a password for root user, i.e. for the main administrator, also, if you want, you can immediately add other users here, i.e. create them using the button " Add User", click " Next»

Step 8

Then leave everything as default and click " Next»

Step 9

That’s it, the MySQL server is configured, click “ Finish»

Step 10

Now you need to configure test data for the MySQL server, click " Next»

Connect to the server, first click “ Check" then " Next»

Step 11

That’s it, the installation is almost complete, click “ Next»

And then " Finish", by the way, if you check the box " Start MySQL Workbench after Setup"then the MySQL Workbench program will start immediately

Launching MySQL Workbench and connecting to the MySQL server

You can launch MySQL Workbench from the menu Start->MySQL->MySQL Workbench 6.2 CE

After starting, you need to select a MySQL server instance in order to connect to it, in our case there is only one ( local), we just click on it

Enter root password user ( which we came up with when setting up the server)

And now we have connected to the MySQL server using MySQL Workbench, we see the test databases and can immediately write some SQL queries

I propose to end here, I hope everything was clear. Good luck!

Please note that in this article I am using only MySQL Server (database server) without visual “goodies”, MySQL Workbench, Connectors, etc.

Why do you need a separate MySQL server installation?

Why is it needed? separate installation servers? For example, for learning to work with databases through a “black screen” of the command line. Or to study SQL commands language and "in live»see your mistakes and practice. Or for self-assembly local server. It doesn't matter why it is needed, it is important that it can be done.

What is MySQL

Before moving on to 5.7.11 on Windows 7, let’s remember what MySQL is and why it’s needed. If you are in the know, feel free to skip the first, introductory part.

This site is dedicated to the creation and development of local sites on all kinds of local servers. In its simplest form, or rather in its simplest assembly, a local server is an assembly of three components: a web server, a database management system and an interpreted dynamic programming language. This assembly is installed for a specific operating system that is installed on your computer.

In this series of articles, we do not look for easy ways and do not use ready-made assemblies local servers can be called local hostings. In this series, we persistently collect local hosting, independently from individual software products.

One of the parts of the local server is the DBMS (database management system). To develop and create websites, it is enough to install the free MySQL DBMS from Aracle. As of March 2016, the current version of MySQL is 5.7.11.

Installing MySQL server 5.7.11 on Windows 7 step-by-step instructions

1.

Download MySQL 5.7.11 for Windows

Go to the official website of the product ( http://www.mysql.com/downloads/) and a page for downloading free components ( http://dev.mysql.com/downloads/).

Go to the MySQL Community Edition tab
Select downloads community server

When downloading, carefully select the installer without confusing the computer system type bit-32 and bit-64 Windows 7. Although a 32-bit program will run on a 64-bit processor.


To download, select MySQL Installer MSI

For convenience, from the MySQL installation methods we do not take ZIP archive, and MSI Installer. This automatic installer, which will download selected software products via the network. The disadvantage of the file is that it only works on machines connected to the Internet, but it is compensated by the ease of installation.


Let me remind you that you can see the system type of your machine in the Start→Computer→Properties→System Type menu.


Checking the processor type on the computer 2.

Running the installer

Downloaded exe file check for viruses, our antivirus program. If the file was taken from the official website, it is guaranteed to be safe.


Launch the MySQL 3 installer.

Incidental installation of software products

To install the MySQL server, two required programs must be installed on your computer:

  • .NET Framework 4
  • Visual Studio C++

By Windows default 7 is already equipped with these programs, although there may be smaller versions.

When you run the MySQL installer, it will inform you about the need to install the necessary software products. As far as I remember, the installer will let you down necessary programs. If not, install them yourself. There is nothing complicated about this, but you can read from me:

  • Install .NET Framework 4
  • Install Visual Studio C++
4.

License Agreement

We continue with the MySQL installation. License Agreement window. This is standard license signing.


installation of MySQL server 5.7.11 on Windows 7 license agreement 5.

Choosing a Setup Type

It is at this stage that we select the installation type, or rather, the MySQL kit to be installed.

  • Developer Default (MySQL Server, MySQL Workbench, Connectors included)
  • Server Only– select and install it, only the server.
  • Client Only
  • Full (MySQL Server, MySQL Workbench, Connectors to choose from)
  • Custom

If you clearly understand what you are doing, you can select Custom and in the set of software products, select the desired package.

By default, the DBMS will be installed in the folder: C:\Program Files\MySQL\MySQL5.7

Let me explain once again why you might find it useful: Server installation Only. For example, you do not use Visual Studio on your computer or you are studying SQL language and want to understand from the inside how to work with databases from the command line, and not “play” with visual pictures.

6.

Installation


Installation server mysql 5.7.11


7.

Product Configuration


Installing the MySQL 8 configuration.

Type and Networking


Type and Networking MySQL 5.7.11

On local machine MySQL supports TCP/IP port - check the box;

Please note: If you check the box: Open freewall port for network access (open port firewall to access the network), then you will not need to make additional permission settings in the Windows 7 firewall.

9.

Account and Roles


Set the MySQL password

Here we need to set a password to work in MySQL. Let's not break traditions and set a password: root. By the way, you won’t be able to get to the next page without setting a password.


Set the MySQL 10 root password.

Windows Server

This is the window simple settings launch MySQL. If you need the server to start when the machine starts, then select the checkbox, as in the photo. If you want to run it as needed, do not select the checkbox (it’s better to check the box).


MySQL configuration for Windows server

Here we slow down: Look at the checkbox: Show advanced options (show additional functions).

11.

On next page the service will be filled with configuration, which will be indicated by green checkmarks.

12.

Installation completed

All! Installation of MySQL server 5.7.11 on Windows 7 is completed. You can make a copy of the entry to the clipboard and put it on your desktop.


installation of MySQL server 5.7.11 on Windows 7 is completed

Starting the MySQL Server

Installation of MySQL server 5.7.11 on Windows 7 is complete. We check that the installation is correct and start the MySQL server.

  • Go to the Start menu;

  • Click on the server start icon: MySQL Command Line Client– Unicode. It will appear there if you have checked the box (10 Windows Server), in the checkbox: Start the MySQL Server at System Startup.
  • A “black window” of the application will open: MySQL5.7 Command Line Client.
  • Enter the password: root and work with the DBMS from the MySQL5.7 Command Line Client windows.

Let's try the first command: question mark [?] or . The server will show basic service commands.

In fact, the screen will be “black”.