How to install and configure MySQL

Source: Internet
Author: User
Tags mysql download

How to install and configure MySQL

For Mysql on all platforms: Download MySQL. Select the MySQL Community Server version you need and the corresponding platform.

1. Install Mysql on Linux/UNIX
On Linux, we recommend that you use the RPM package to install Mysql. MySQL AB provides the following RPM packages:

MySQL-MySQL server. You need this option unless you only want to connect to the MySQL server running on another machine.
The MySQL-client-MySQL client program is used to connect to and operate the Mysql server.
MySQL-devel-library and inclusion files. If you want to compile other MySQL clients, such as the Perl module, you need to install this RPM package.
MySQL-shared-This package contains the shared Library (libmysqlclient. so *) that needs to be dynamically loaded by some languages and applications, using MySQL.
MySQL-benchmark-MySQL database server benchmark and performance testing tool.
The following is an example of installing Mysql RMP on SuSE Linux. Of course, this installation step is also suitable for other Linux systems that support RPM, such as Centos.

Installation StepsAs follows:

Log on to your Linux system as the root user.

Download the Mysql RPM package: MySQL download.

Run the following command to install Mysql:

[Root @ host] # rpm-I MySQL-5.0.9-0.i386.rpm
The above process creates a mysql user and creates a mysql configuration file my. cnf.

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

The following is the installation process of some optional mysql packages. you can install them as needed:

[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

Ii. Install Mysql on Windows
Windows is relatively easy to install Mysql. You only need to download the Windows MySQL installation package and decompress the installation package.

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

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

Mysqld.exe -- console
If the installation is successful, the above commands will output some mysql startup and InnoDB information.

Iii. Verify Mysql Installation
After Mysql is successfully installed, some basic tables are initialized. After the server is started, you can test it to verify that Mysql works properly.

Use the mysqladmin tool to obtain the server status:

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

[Root @ host] # mysqladmin -- version
On linux, the command will output the following results, which are based on your system information:

Mysqladmin Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386
If no information is entered after the preceding command is executed, your Mysql installation is successful.

Thu,Use MySQL Client to execute simple SQL commands
You can use the MySQL command on the Mysql Client to connect to the mysql server. By default, the password of the Mysql server is blank, so you do not need to enter a password for this instance.

The command is as follows:

[Root @ host] # mysql
After the preceding command is executed, the mysql> prompt is output, indicating that you have successfully connected to the Mysql server. You can run the SQL command at the mysql> prompt:

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

5. What needs to be done after Mysql Installation
After Mysql is successfully installed, the default root user password is blank. You can use the following command to create a root user password:

[Root @ host] # mysqladmin-u root password "new_password ";
Now you can use the following command to connect to the Mysql server:

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

Note:When you enter the password, the password will not be displayed. You can enter it correctly.

6. Start MySQL at Linux Startup
If you need to start the MySQL server at Linux Startup, you need to add the following command in the/etc/rc. local file:

/Etc/init. d/mysqld start
Similarly, you need to add the mysqld binary file to the/etc/init. d/directory.

The above is all the content of this article, hoping to help you learn.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.