Installing MySQL on Windows (4). Installing Mysql: step-by-step instructions Installing mysql server windows 7

Last update: 12/19/2017

MySQL is not an integral component for creating PHP websites. We can use different database systems, but MySQL is by far the most popular database management system for working with PHP, and it is also 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 version of Windows, 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 accepting the license agreement, you will be prompted to select an installation type. Let's select the Developer Default type:

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 following set of configurations, which we will also leave as default, specifies that the server will start as a Windows service when the operating system starts:

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, the installation and configuration of the MySQL server will be finally completed and we can use the server to access the databases.

MySQL is a database management system used primarily in small and medium-sized applications. The DBMS is free for non-commercial use. MySQL uses the SQL query language and has many extensions to this standard. The advantages of MySQL include:

Multithreading
Unlimited number of users simultaneously working with the database
Fast command execution
Support for a large number of table types

MySQL installation

For installation we will use program version 5.5.23. We launch the distribution with the program:

Rice. 1. Start installation window, click Next.

Rice. 2. Accept the license agreement

Rice. 3. Select the Custom installation type

Rice. 4. Window for selecting additional components and the installation directory, leave everything as is, click Next.

Rice. 5. Click Install to install the program

Rice. 6. Click Finish to complete the installation and proceed to setting up the server

Rice. 7. Select Detailed Configuration - detailed settings

Rice. 8. Select Developer Machine - this means that MySQL will use a minimum of RAM so as not to interfere with the execution of other applications

Rice. 9. Select the Multifunctional Database item, this will allow you to work with different types of tables in the future

Rice. 10. Select a disk and directory for storing InnoDB tables, leave it as is

Rice. 11. Here you select the maximum possible number of connections to the MySQL server. Selecting Decision Support (DSS)/OLAP

Rice. 12. Here we leave the Enable TCP/IP Networking checkbox enabled, leaving support for TCP/IP connections enabled. We also leave the port equal to 3306, this is the standard port for the MySQL server. The Enable Strict Mode checkbox specifies the mode of strict compliance with the SQL standard; we leave it untouched

Rice. 13. By checking Manual Selected Default Character Set / Collation and selecting the cp1251 encoding from the drop-down menu, we ensure correct work with the Russian language

Rice. 14. The Install As Windows Service checkbox means that the server will be launched as a service, which is the recommended startup method. Select the service name in the drop-down window; leave it as is. Let's uncheck Launch the MySQL Server automatically, this means that the server will be launched manually. Leave the checkbox for Include Bin Directory in Windows PATH in place

Rice. 15. Set some simple password for the root user

Rice. 17. The path next to the Write configuration file line indicates the location of the configuration file, which will need to be edited slightly

Editing a Configuration File

Editing the configuration file with notepad my.ini, located at the address indicated in the previous paragraph (opposite the line Write configuration file) in the installation completion menu. The paths to the files may not coincide with those written, so it is worth specifying the directories of the computer on which the work is being carried out.

1. In the section, after the line:

add a line defining the directory containing encoding description files:

2. In the section, after the line:

add the following two lines, the first of which is already known to you, 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″

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. Server installation and configuration is complete.

Installing the DBMS graphical interface

For example, we will use the graphical interface of MySQL Workbench version 5.2.40

Rice. 18. Select the directory to install the graphical interface by clicking Change

Rice. 19. Install the graphical interface in the folder with the installed DBMS

Rice. 20. Select the installation type Complete (default)

Rice. 21. After clicking the Install button, the installation process will begin

Rice. 22. Installation completion window, click Finish

Examples of working with MySQL

To get started, launch the MySQL Workbench we installed earlier:

Rice. 23. Main window of the program. In the list of connections we see a ready-made connection that was created during the installation of the DBMS. When you double click on Local instance MySQL, a window will appear in which you will need to enter the database password that we set in Fig. 15

Rice. 24. The query editing window will open. To get started, you need to connect directly to the database. We will use an already created test database called test. By double-clicking on the database name in the left part of the program’s working window, we connect. You can start writing test queries in the input window in the middle of the working window

Examples of SQL queries and their implementation using MySQL Workbench

1. Create a table

CREATE TABLE example
id int(11) NOT NULL PRIMARY KEY auto_increment,
name varchar(50),
age int(2),
info text,
date date
);

This query will create a table example, in which id is the primary key (set automatically), name is a text format field with a maximum allowed value of 50 characters, age is a numeric value field with a maximum allowed number of characters 2, info is a text field of unlimited size, date is A date field that automatically uses today's date.

Let's place this request in the program input field and press ctrl+shift+enter, thereby executing it:

Rice. 25. After executing the query, right-click on the test database name and select Refresh All. Then our created example table will appear in the Tables drop-down list.

Right-click on it and select Edit Table Data:

Rice. 26. The program will display the created table for us.

Rice. 27. And click Apply. A request confirmation window will open (requests in the program are generated automatically and executed in the form of scripts), where you will need to confirm the actions by clicking the Apply and Finish buttons.

Let's try using a select query:

SELECT * FROM example WHERE id = "2"

which will select a row from the table with the id field value equal to 2. We execute the query using the key combination ctrl+shift+enter:

Rice. 28. Result of query execution

List of materials and Internet resources used:

Friends! Join our

) is one of the most used open source DBMS (Database Management Systems). The Community version is distributed under the terms of the GPL license.

Let's start the installation. Run the installation package (mysql-essential-5.0.51b-win32.msi). The default settings are quite normal (the DBMS server will be installed in C:\Program Files\MySQL\MySQL Server 5.0). After installation is complete, leave the “Configure the MySQL Server now” checkbox enabled. The MySQL Server Configurator will launch.

Click Next.

In this dialog, select "Detailed Configuration".

Then there are three options to choose from: “Developer Machine”, “Server Machine” and “Dedicated MySQL Server Machine”. As you can guess from the descriptions, the first option specifies to consume minimum memory, the second - for average consumption, the third - for maximum. If you are installing servers on a home computer that you use, for example, for games, then leave the first option; if you install servers on a separate computer (for example, you have two of them and you want to allocate the second one for the server), then select the second option. You are unlikely to need the third option (it is needed for dedicated DBMS servers).

On the next page you select the available database engines. The MyISAM engine is faster, but does not support transactions, and InnoDB is a little slower, but does support transactions. However, if you are not going to develop your own web applications, then this should not worry you too much. Select "Multifunctional Database" to enable both engines.

In the next dialog, you select the storage location for the InnoDB tables (this step will only happen if you selected the first or second option in the previous step). The default storage location is fine.

In the next step you set the number of simultaneous connections. The first option is 20, the second is 500, the third is your number. Note: 20 connections does not mean that only 20 users can access your site at the same time. The script's session with the database lasts a maximum of a couple of seconds, so users on the site are not constantly connected to the database. This is something like distributing processor time between programs. The first option is quite enough.

On the next page - server network settings and SQL mode. Leave the settings as default.

The next step is to select the default encoding. I prefer to set the default encoding to utf8 - this is the second option. You can also select the third option and set the encoding to cp1251. Anyway, as far as I know, most CMSs specify the encoding explicitly when creating tables, so you will need this if you are going to develop your web applications.

The next dialog is the MySQL service settings. Leave everything here as default.

In the next step, set a password for the superuser (root). Initially, access to the database from outside is prohibited for the superuser (the corresponding checkbox is disabled on this page). So, a long password is not so necessary here. But in any case, security is not the last thing, so set some password. In any case, then we will create another user. Do not set the “Create An Anonymous Account” option - this is harmful from a security point of view.

That's it, now click Execute. The settings will be applied. Click Finish to complete the setup.

Next we will install the MySQL GUI Tools package. This is a very convenient set of utilities for MySQL server administration from the DBMS developers themselves. I personally prefer GUI Tools over phpMyAdmin. If you don't want to use MySQL GUI Tools and prefer phpMyAdmin, you can skip this step.

Launch the installer (mysql-gui-tools-5.0-r12-win32.msi). The default settings are quite satisfactory. After installation is complete, the utilities can be accessed from the Start menu. Launch MySQL Administrator.

In the “Server Host” field enter localhost, in the “Username” and “Password” fields - root and the password that you set in the configurator, respectively. Click OK. The following window will appear:

You can see what is responsible for what here in the article, “Working with MySQL in MySQL GUI Tools.”
Go to the “Catalogs” page. A list of databases will appear below. Right-click on an empty space in it and select “Create New Schema” from the menu. Enter a name for the new database, for example SiteForum. A new database will be created. Now we will set the user and access rights for it. Go to the “User Administration” page.

Click the "Add new user" button. In the MySQL User field, enter forumuser, for example. You can enter something in the “Password” field, or you may not enter it. There is no need to enter anything complicated. Go to the "Schema Privileges" tab. In the list on the left, select the newly created database - siteforum. A list of privileges for this database will appear in the right list. You can choose all privileges. Then click the "<» (или «<<» для переноса всех привилегий). Теперь привилегии пользователя установлены, вы можете нажать кнопку «Apply changes».
That's it, the server is ready to work. Now, when installing a forum, select the siteforum database and the forumuser user.

For Win 32 download: Windows (x86, 32-bit), MSI Installer Essentials - Recommended

For Win 64 download: Windows (x86, 64-bit), MSI Installer Essentials - Recommended

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!”).

Launch the installer and click Next:

Select the installation type Custom:

Selecting components. Here you can change the installation path of the MySQL files (select MySQL Server, click the Change button), as well as the path for storing databases (select MySQL Server Datafiles, click the Change button):

Check the paths and click Install:

The final stage of installation. Check the “Configure the MySQL Server now” option and click Finish:

Setting up MySQL

After installation is complete, the MySQL Server Instance Configuration Wizard starts (you can run it manually from the Start menu -> All Programs -> MySQL -> MySQL Server 5.1 -> MySQL Server Instance Config Wizard). Click Next:

We select the installation script: Developer Machine - for installation on a home computer (our choice), Server Machine - for installation on a server, Dedicated MySQL Server Machine - for installation on a server completely dedicated to MySQL. These options primarily affect the amount of memory consumed by MySQL:

MySQL supports two main types of databases (InnoDB - with transaction support and MyISAM - without transactions). Multifunctional Database - support for both types of databases will be installed (our choice). Transactional Database Only - only InnoDB support will be installed. Non-Transactional database Only - only myISAM support will be installed.

If you selected InnoDB support in the previous step, you can configure the location of the InnoDB data files here:

Supports simultaneous connections. Decision Support - up to 20 simultaneous connections (our choice). Online Transaction Processing - up to 500 connections. Manual Setting—manually setting the number of connections.

Check the “Enable TCP/IP Networking” and “Enable Strict Mode” options. We leave the Port Number unchanged - 3306. If you plan to connect directly to the server from other computers, check the “Add firewall exception for this port” option (open the port in the windows firewall).

Select the default encoding. Right now, the smartest choice is UTF-8. Select the Best Support For Multilingualism option:

Be sure to check the “Install as Windows Service” option (run as a Windows service). Check “Launch the MySQL Server automatically” if you need the service to autostart.

The final stage. Setting the administrator password (root). It's better not to lose this password! I do not recommend checking the “Enable root access from remote machines” and “Create An Anonymous Account” options, because they reduce safety.

How to quickly check the installation?

Open Start -> All Programs -> MySQL -> MySql Server 5.1 -> MySQL Server Command Line Client (a utility for working with MySQL on the command line).

Next, enter the administrator password (root). If the password is correct, you will be taken to the command line (mysql>). Enter the command: show databases; (a semicolon at the end is required). As a result, you should see a list of databases (at least two - information_schema and mysql). This means the server is working correctly. Close the command line by executing the exit command.

ATTENTION! To connect to MySQL from PHP, from a server installed on the same computer, you need to use MySQL as the server address instead of localhost use 127.0.0.1 !!!

The nature of this glitch is not completely clear to me, but it took me half a day to discover it...

What should I do if the automatic installation fails?

How to work with databases?

One of the most popular programs (maybe the most popular) for working with MySQL is phpMyAdmin.

Hi all! Today we will show the installation process MySQL version server 8.0 on Windows 10 using the automatic installer. Before this, we already told you how to install a MySQL server on CentOS 7, now we decided to touch on a slightly more well-known platform.

Installation

So, let's begin. As I mentioned earlier, we will use the automatic installer, which you need to download from the following link: https://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-8.0.11.0.msi

The file weighs approximately 200 MB, and it already contains everything necessary for installation. Double-click on the executable file, accept the terms of the license agreement (check mark) and click Next.

Next, we select the installation type, of which there are several - installation of a ready-made “developer kit”, installation of only the server, only the client, full installation (first option + additional tools) and custom. In our case, we choose to install a server.



Then click Next.


Go to the setup stage - click Next.


Since we are showing the simplest installation, select the first option, just like in the screenshot - a separate MySQL server and click Next.


Configuring network parameters - for demonstration purposes we left everything at default.


Then we configure the authentication parameters - select the first option and click Next.


We set a root password for the server - the more complex, the better. We recommend using at least the password from 12 characters, containing letters, numbers and special characters. You can also add users at this stage - we, for example, added a user asterisk.





Completing the installation and testing functionality

Ready! Now all you have to do is click Finish twice - congratulations! You have installed MySQL server.


Now let's check its performance. To do this, you need to open the application that was installed with the server - MySQL 8.0 Command Line Client. You will need to enter the root password that you specified during installation and then run the show databases command;