Install Mysql and windowmysql on Linux/UNIX and Windows Platforms
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.
MySQL-client-The 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 must be dynamically loaded by some languages and applications, using MySQL.
MySQL-connector-MySQL database server benchmark and performance testing tools.
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.
The installation procedure is as follows:
Log on to your Linux system as the root user.
Download the Mysql RPM package.
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.
1. 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.
2. Use the 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)
3. 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-p
Enter password :*******
Note: The password is not displayed when you enter the password. You can enter the password correctly.
4. 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.