MySQL Installation Configuration Method Tutorial

  • 2021-01-18 06:42:24
  • OfStack

All platforms Mysql download address is: MySQL download. Choose what you need MySQL Community Server version and the corresponding platform.

1. Install Mysql on Linux/UNIX
RPM is recommended to install Mysql on the Linux platform. MySQL provides the following download address for RPM:

MySQL - MySQL server. You need this option, unless you only want to connect to the MySQL server running on another machine.
MySQL-client - MySQL client program for connecting to and operating Mysql server.
MySQL-devel - libraries and included files. If you want to compile other MySQL clients, such as the Perl module, you will need to install the RPM package.
MySQL-shared - This package contains shared libraries that certain languages and applications need to load dynamically (libmysqlclient.so*), using MySQL.
MySQL-bench - MySQL database server benchmarking and performance testing tools.
The following example of Mysql installation was performed on an SuSE Linux system, but this installation procedure is also applicable to other Linux systems that support RPM, such as Centos.

Installation steps are as follows:

Log on to your Linux system using root User.

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

rpm is the rpm package you downloaded:

[root@host]# rpm -i MySQL-5.0.9-0.i386.rpm
The above process of installing the mysql server will create the mysql user and create an mysql configuration file my.cnf.

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

The following is the installation process of some mysql optional packages, you can install according to your own 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

2. Install Mysql on Window
Installing ES97en on ES96en is relatively easy. You just need to download the ES99en version of the ES100en installation package from the ES98en download and unpack the installation package.

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

Next you can switch to the C: mysql\bin directory at the command prompt by "Start" = "type" cmd" command = "in the search box and type 1:

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

3. Verify Mysql installation
After a successful installation of Mysql, some basic tables will be initialized. After the server starts, you can verify that Mysql is working with a simple test.

Use the mysqladmin tool to get the server status:

Using mysqladmin commands both check the server version, the 2 base on linux file located in/usr bin on linux, on the 2 window hexadecimal file located in C: \ mysql \ bin.

[root@host]# mysqladmin --version
This command on linux will output the following results, based on your system information:

mysqladmin Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386
If you do not enter any information after executing the above command, your Mysql was not successfully installed.

4. Execute a simple SQL command using MySQL (Mysql client)
You can use the mysql command to connect to the Mysql server from MySQL (Mysql client). By default, the Mysql server's password is empty, so there is no need to enter a password for this example.

The command is as follows:

[root@host]# mysql
The above command will output mysql when executed > Prompt, this indicates that you have successfully connected to the Mysql server, which you can use in mysql > Prompt to execute the SQL command:


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

5. What to do after Mysql installation
Upon successful installation of Mysql, the default password for root user is null. You can create a password for root user by using the following command:

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


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

Note: when entering the password, the password will not be displayed. You can enter it correctly.

6. Start MySQL when the Linux system is booted
If you need to start the MySQL server when the Linux system is booted, you need to add the following command to the file /etc/rc.local:

/etc/init.d/mysqld start
Also, you need to add mysqld 2 hexadecimal file to the/etc/init d/directory.

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


Related articles: