You get a bonus - 1 coin for daily activity. Now you have 1 coin

Installing MySQL with screenshots (a step-by-step guide)

Practice




This article describes the process of installing and initially configuring, on a local computer running Windows XP, a well-proven set of programs used to build both large and medium-sized web projects: Apache, MySQL, PHP, and phpMyAdmin.




Developer website: http://www.mysql.com/

Documentation: http://dev.mysql.com/doc/

Distribution: http://dev.mysql.com/downloads/mysql/5.1.html

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





Installing MySQL with screenshots



Next, the dialog boxes where you need to make some kind of choice will be shown.



Installing MySQL with screenshots (a step-by-step guide)




In this window, select the custom component installation option "Custom".



Installing MySQL with screenshots (a step-by-step guide)




Here you can select additional components and change the program's installation directory.



Installing MySQL with screenshots (a step-by-step guide)


You'll see a window like this — click "Install".






Now let's move on to configuring the MySQL server.


Installing MySQL with screenshots (a step-by-step guide)




Select the detailed setup option - "Detailed Configuration".


Installing MySQL with screenshots (a step-by-step guide)




Check "Developer Machine". We're developers after all, right? :)


Installing MySQL with screenshots (a step-by-step guide)




By selecting "Multifunctional Database", you'll be able to work with both InnoDB tables (with support for transactions) and the high-speed MyISAM (which is typically the table type used for web development).


Installing MySQL with screenshots (a step-by-step guide)




Choose the disk and directory for storing InnoDB tables.




In this dialog box you choose the maximum number of connections to the MySQL server. If you select "Decision Support (DSS)/OLAP", the maximum number of connections will be limited to twenty, which is more than enough when installing the server on a home computer without a large number of simultaneous connections.



Installing MySQL with screenshots (a step-by-step guide)




By checking "Enable TCP/IP Networking" we enable support for TCP/IP connections and choose the port they'll use. The standard port for the MySQL server is 3306. By checking "Enable Strict Mode", we set strict SQL standard compliance mode (it's recommended to leave this option enabled).



Installing MySQL with screenshots (a step-by-step guide)




Pay attention to the settings in this window. By checking "Manual Selected Default Character Set / Collation" and choosing "cp1251" from the drop-down menu, we specify that the tables will initially use Cyrillic Windows encoding (cp1251), which means correct handling of Russian text in that encoding.



Installing MySQL with screenshots (a step-by-step guide)




If you check "Install As Windows Service", the server will start as a service, which is the recommended way to run it. Below, in the drop-down list, you specify the service name.


Installing MySQL with screenshots (a step-by-step guide)



Next, uncheck the box next to "Launch the MySQL Server automatically" - we'll be starting the server manually. Also check the box next to "Include Bin Directory in Windows PATH" - this will make the "bin" directory visible for the command line.


 




 


Installing MySQL with screenshots (a step-by-step guide)


Set a password for the "root" user. I recommend doing this. Set at least some simple password, just don't leave the field empty - this will save you from possible trouble down the road.


 


 


Installing MySQL with screenshots (a step-by-step guide)




In this window, pay attention to the "Write configuration file" line, which points to the location of the MySQL configuration file - "my.ini", which we'll need to edit slightly later.


Installing MySQL with screenshots (a step-by-step guide)






Open the "my.ini" file for editing.

In the [client] section, after the line:

port=3306

Add a line specifying the directory containing the character set description files:

character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.1/share/charsets"

In the [mysqld] section, after the line:

port=3306

Add the following two lines, the first of which you already know, and the second sets the encoding in which data is transmitted by MySQL:

character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.1/share/charsets"

init-connect="SET NAMES cp1251"

Next, find the line:

default-storage-engine=INNODB

Replace the initially set table type with MYISAM:

default-storage-engine=MYISAM

Save the changes and close the "my.ini" file.

Installing and configuring the MySQL server is complete.


 


 


 


Or simply 


Take the my.ini file

and copy it to the folder where MySQL is installed

c:\Program Files\MySQL\MySQL Server 5.1\my.ini



 

# MySQL Server Instance Configuration File
# CLIENT SECTION


[client]
port                  = 3306
default-character-set = cp1251
character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.1/share/charsets"

[mysql]
character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.1/share/charsets"


# Default database encoding.
default-character-set = cp1251
init-connect = "set names cp1251"
skip-character-set-client-handshake



[mysqld]


port=3306
character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.1/share/charsets"
init-connect="SET NAMES cp1251"
 basedir="C:/Program Files/MySQL/MySQL Server 5.1/"
 datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"
 default-character-set=latin1
 default-storage-engine=MYISAM

 sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

max_connections=100
query_cache_size=0
 table_cache=256
 tmp_table_size=5M
 thread_cache_size=8
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=8M
key_buffer_size=8M
 read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=212K
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=8M
innodb_log_file_size=10M
innodb_thread_concurrency=8


[mysqld]

set-variable=character_sets_dir=C:/WebServers/usr/local/mysql/share/charsets
set-variable=default_character_set=cp1251

[client]

default-character-set=cp1251

 

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Databases - MySql (Maria DB)"

Terms: Databases - MySql (Maria DB)