Latest web development tutorials

MySQL Installation

All platforms Mysql download address is: the MySQL download selection you need and the corresponding version ofMySQL Community Serverplatform.


Mysql installation on Linux / UNIX

Recommended use on Linux RPM package to install Mysql, MySQL AB provides the download address the following RPM package:

  • MySQL - MySQL server. You need this option unless you want to connect to another machine running the MySQL server.
  • MySQL-client - MySQL client program to connect and operate Mysql server.
  • MySQL-devel - Libraries and include files, if you want to compile other MySQL clients, such as Perl module, you need to install the RPM package.
  • MySQL-shared - This package contains certain languages and applications need to dynamically load shared libraries (libmysqlclient.so *), use MySQL.
  • MySQL-bench - MySQL database server benchmark and performance testing tools.

The following examples Mysql RMP is installed on a SuSE Linux system, of course, the installation procedure suitable for additional support RPM-based Linux systems, such as: Centos.

Installation steps are as follows:

Use root user login on your Linux system.

Download Mysql RPM package, download address: the MySQL download .

By the following command Mysql installation, rpm package for you to download the rpm package:

[root@host]# rpm -i MySQL-5.0.9-0.i386.rpm

Mysql server installation process above will create mysql user and mysql to create a configuration file my.cnf.

You can find all the relevant MySQL binaries in / usr / bin and / usr / sbin in. All data tables and databases will be created in / var / lib / mysql directory.

Here are some optional package mysql installation process, you can install according to their needs:

[root@host]# rpm -i MySQL-client-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-devel-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-shared-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-bench-5.0.9-0.i386.rpm

Mysql installation on Window

Mysql installation on Window will be relatively simple, you just need to upload MySQL download download window version of the mysql installation package, and extract the installation package.

Double-click the setup.exe file, then you only need to install the default configuration click "next" to install by default the information will be C: \ mysql directory.

Then you can use the "Start" = "in the search box, enter" cmd "command =" in the command prompt, switch to the C: \ mysql \ bin directory and enter the following command:

mysqld.exe --console

If the installation is successful the above command prints some mysql start and InnoDB information.


Verify Mysql installation

After a successful installation Mysql, the table will list some basic initialization after server startup, you can by a simple test to verify that Mysql is working properly.

Use mysqladmin tool to get the server status:

Use mysqladmin command to check both the server version, on the linux binary is located in / usr / bin on linux, in the window of the binary file is located in C: \ mysql \ bin.

[root@host]# mysqladmin --version

On linux command will output the following results, the results are based on your system info:

mysqladmin  Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386

If the above command is not entered after executing any information to show that you Mysql is not installed successfully.


Use MySQL Client (Mysql client) execute simple SQL commands

You can use the MySQL Client (Mysql client) mysql command to connect to a Mysql server, server Mysql default password is empty, so in this example does not require a password.

Command is as follows:

[root@host]# mysql

After executing the above command output mysql> prompt, indicating that you have successfully connected to the Mysql server, you can mysql> prompt, execute SQL commands:

mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
| mysql    |
| test     |
+----------+
2 rows in set (0.13 sec)

Mysql needs to be done after installation

Mysql After successful installation, the default root user password is empty, you can use the following command to create a root user password:

[root@host]# mysqladmin -u root password "new_password";

Now you can by the following command to connect to Mysql server:

[root@host]# mysql -u root -p
Enter password:*******

Note: When you enter a password, the password is not displayed, you can correct input.


Linux system startup MySQL startup

If you need to start the MySQL server when the Linux system startup, you need to add the following command in the /etc/rc.local file:

/etc/init.d/mysqld start

Again, you need to add the mysqld binary to the /etc/init.d/ directory.