Installing MySQL Server

written by: George Ionescu; article published: year 2008, month 01;


In: Categories » Computers and technology » Databases » Installing MySQL Server

Installing MySQL is relatively painless. First, you need the installation program for MySQL, which is available on the companion CD. You can also download the latest version from http://www.mysql.com.

Note 

If you choose to install MySQL in a different folder than the default (C:\MYSQL) or you wish to start MySQL on NT/Win2000 as a service, you need to create a file named MY.CNF in the root of your C:\ drive with the following information in it (or append the following information to either \Windows\my.ini or \winnt\my.ini, depending on your OS):

[mysqld]  basedir=E:/installation-path/  datadir=E:/data-path/

After you have installed MySQL, the directory will contain the my-example.cnf file. You can use this as a template to create your own my.cnf file.

Once you start the installation, it will first ask you which type of setup you would prefer: typical, compact, or custom installation. Here we will select the Typical option, as it will install all the components that we require in order to work with MySQL.

After selecting Typical, press the Next button and the installation process will be automatically completed.

Now that we have MySQL installed, we will first browse the directory so we can see what it has installed for us.

All we really have use for here (with respect to Java) is the bin directory, which contains the MySQL server and client executables, and the docs directories, which contain the HTML version of the MySQL manual.

Note 

An Adobe PDF version of the MySQL manual has also been supplied on the companion CD-ROM. We find this easier to read, but you will also require the free program Adobe Acrobat Reader to view this manual, which is available to download at http://www.adobe.com/products/acrobat/readermain.html.

Let's now take a look in the bin directory and see what is of use to us there. As you can see, there are many executables in this directory; some are daemons (i.e., the MySQL server), and some are console-based clients to access the MySQL server with.

Note 

A daemon is simply a program or process that sits idly in the background until it is invoked to perform its task.

mysqld.exe is the best server to use when developing software. The others are used more to adjust speed and support extra features. Here are each of the different server versions and their uses:

  • mysqldCompiled with full debugging and automatic memory allocation checking, symbolic links, and InnoDB and BDB tables

  • mysqld-opt—Optimized binary with no support for transactional tables

  • mysqld-nt—Optimized binary for NT with support for named pipes. You can run this version on Win98, but in this case no named pipes are created and you must have TCP/IP installed.

  • mysqld-max—Optimized binary with support for symbolic links and InnoDB and BDB tables

  • mysqld-max-nt—Like mysqld-max, but compiled with support for named pipes

If you do not fully understand the meaning of the different versions, simply stick to using mysqld.exe, as you probably will not require the others.

The executable mysql.exe is a console-based client, which is used to interact with the MySQL server by means of the SQL language.

The obvious thing to do now is run a MySQL server so we can access it via the client. The executable we want for this is called mysqld.exe. There might be cases when the debug version of MySQL is better (information about errors, etc.). But in general, one version is as good as the other for running the MySQL server in the background. If you now execute this, a black window will appear for a very short period of time and disappear. You can check that the MySQL server is running by hitting Ctrl, Alt, and Delete at the same time to bring up the list of tasks that are currently running in Windows.

Note 

In Windows NT and Windows 2000, Ctrl+Alt+Del produces a different window than in Windows 98. Windows XP also has a different view.

Windows NT and Windows 2000 have a slightly different approach when starting the MySQL server.

Note that you may have more on this list if you are running other programs. Also, the Mysqld daemon may not be at the bottom of the list.

Now, if we try to run the MySQL console client (mysql.exe), we can see that it will connect to the MySQL server and display a welcome message and then await input.

Now we are able to connect to the MySQL server from the MySQL console client. One problem is that every time we restart Windows, the MySQL server will not be restarted, meaning we would have to manually go to the directory and run the mysqld-opt.exe every time we start Windows. This can be solved by adding the MySQL server as a service that is started every time Windows is loaded up.

legal disclaimer

1) Our website is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringements, please read the Terms of service and contact us to investigate the problem.
2) The E-articles directory team is not responsible for inaccuracies, falsehoods, or any other types of misinformation this tutorial may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here. Please read the Terms of service

Useful tools and features

Translate this article to...    Send this article to you or to a friend

Link to this article from your page   
If you like this article (tutorial), please link to it from your web page using the information above. Linking to this page, this is the only way to help us improve our service, the same time providing your visitors with a way to improve their online experience.

related articles

1. Basic Terms of Structured Query Language (SQL)
The first questions to ask are what is SQL and how do you use it with databases? SQL has three main roles: 1. Creating a database and defining its structure 2. Querying the database to obtain the data necessary to answer questions 3. Controlling database security Defining database structure includes creating new database tables and fields, setting up rules for data entry, and so on, which is expressed by a SQL sublanguage called Data Control Language (DCL). The next section discusses querying ...

2. Managing and Monitoring SQL Server 2000 Security
Authentication There are two methods of authentication offered SQL Server 2000, Windows authentication and SQL Server authentication. Windows authentication allows the SQL server authentication to be integrated directly with security on a Windows 2000/NT system. Authentication will depend on the security mode that SQL Server 2000 runs under, Windows Authentication mode, or Mixed Mode. If you are running SQL Server 2000, you will need to configure the SQL server to run in mixed mode to allow the non-Win...

3. Managing Monitoring and Troubleshooting SQL Server 2000
SQL Server Agent Jobs SQL Server Agent is a job scheduling agent that aids in the management of a SQL server. SQL Server Agent can be started when the operating system starts and is configured through the SQL Service Manager or Enterprise Manager. The SQL Server Agent is responsible for the execution of jobs. Jobs are made up of multiple steps that have instructions on what to do depending on the success or failure of each step in the job. Jobs are assigned to an operator, a user who is responsible for tha...

4. Managing Monitoring and Troubleshooting SQL Server 2000 Databases
Troubleshooting SQL Databases is an operation that supposes multiple actions. They are described below. Optimizing Database Performance Database performance is an important part of administering a SQL Server 2000 environment. There are many ways that performance can be increased including indexing, locking and recompiling. Indexing Establishing indexes can dramatically increase query performance, but can also adversely affect data modification performance. Any changes to an...

5. Tips for Designing a Better SQL Database
Keeping the following subjects in mind helps ensure that your database design and updates go smoothly. Don’t design a database that copes with the norm. Tempting as it is to design a database that covers most situations, doing so is dangerous. The unexpected happens just when you least expect it, so make sure you design your database to cover all situations that could arise, or at least ensure that it can cope with the unusual situations. Even if a client tells you not to worry about the possibility of two people attem...

6. Why and When to Use a Database
When there are a huge number of alternative ways to store data, why should you trouble yourself creating a database? What advantages does a database hold? The main advantage is fast and efficient data retrieval. A database helps you to organize your data in alogical manner. Database management systems are fine-tuned to rapidly retrieve the data you want in the way you want it. Databases also enable you to break data into specific parts. Retrieving data from a database is called querying. You’ll often see the term SQL query, which brief...

7. Creating SQL Server 2000 Databases
Attaching and Detaching Databases Detaching/attaching is used in moving a database between computers or physical disks. When a database is detached, the links from the server to the data files and transaction logs are removed. When you attach a database, you re-establish those links. When you detach and re-attach, you eliminate the need to restore the database backup manually. When a database is reattached, all files that have changed location must be specified. Filegroups Filegroups ar...