MySQL installation tutorial MySQL installation tutorial

MySQL installation tutorial

 
Installation under WINDOWS:
1. Download MySQL
The official website of the database http://www.mysql.com download MySQL
 
2. Install Process
 
3. Note:
You need to set the root account password, and you want to record
Fool installation
After installation is complete, go to the bin directory, open a command window, you can use the command to view database information
 
 
LINUX / UNIX install MySQL at:
Recommended on Linux RPM package to install Mysql, MySQL AB provides Download the RPM package:
MySQL - MySQL server. You need this option unless you want to connect to another machine running MySQL server.
MySQL-client - MySQL client program to connect and operate the server Mysql.
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 *), the use of MySQL.
MySQL-bench - benchmark and performance testing tool for MySQL database server.
Before installation, we can detect whether the system comes installed MySQL:
rpm -qa | grep mysql
If you have 40, you can choose to uninstall:
rpm -e mysql // delete common mode
rpm -e --nodeps mysql // strong delete mode, if you use the above command to delete, suggesting other files rely on, use the delete command can be strong
Install MySQL:
Next we use in Centos7 system command yum install MySQL, to note that CentOS 7 version of the MySQL database from the default list of programs removed, so we need to go before installing the official website to download Yum resource package, download address : https://dev.mysql.com/downloads/repo/yum/
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
yum install mysql-server
Permission settings:
chown mysql:mysql -R /var/lib/mysql
Initialization MySQL:
mysqld --initialize
Start MySQL:
systemctl start mysqld
View MySQL running state:
systemctl status mysqld
Note: If we are the first start mysql service, mysql server will first be configured to initialize.
In addition, you can use instead of MariaDB, MySQL MariaDB database management system is a branch, mainly by the open source community in the maintenance, under the GPL license. One reason for the development of this branch is: after Oracle's acquisition of MySQL, there are potential risks to MySQL closed source, so the branch community a way to avoid this risk.
MariaDB purpose is fully compatible with MySQL, including API and command line, so that it can easily become a substitute for MySQL.
yum install mariadb-server mariadb
Mariadb database related commands are:
systemctl start mariadb #启动MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重启MariaDB
systemctl enable mariadb # Set boot

Verify MySQL installation

After a successful installation of MySQL, the table will list some basic initialization, after the server is started, you can verify that MySQL is working correctly by simple tests.
Use mysqladmin tool to get the server status:
Use mysqladmin command to check the server version of linux on the binary file is located in / usr / bin directory on the Windows binary file is located in C: \ mysql \ bin.
[root@host]# mysqladmin --version
On the linux command outputs 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 does not output any information after the execution, state your Mysql is not installed successfully.

Execute simple SQL commands to use MySQL Client (Mysql client)

You can use the MySQL Client (Mysql client) mysql command to connect to the MySQL server, default login password for the MySQL server is empty, so in this instance is not required to enter 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 need to do after installation

Mysql After successful installation, the default root user password is empty, you can create the root password, use the following command:
[root@host]# mysqladmin -u root password "new_password";
Now you can connect to Mysql server with the following command:
[root@host]# mysql -u root -p
Enter password:*******
Installation under WINDOWS:
1. Download MySQL
The official website of the database http://www.mysql.com download MySQL
 
2. Install Process
 
3. Note:
You need to set the root account password, and you want to record
Fool installation
After installation is complete, go to the bin directory, open a command window, you can use the command to view database information
 
 
LINUX / UNIX install MySQL at:
Recommended on Linux RPM package to install Mysql, MySQL AB provides Download the RPM package:
MySQL - MySQL server. You need this option unless you want to connect to another machine running MySQL server.
MySQL-client - MySQL client program to connect and operate the server Mysql.
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 *), the use of MySQL.
MySQL-bench - benchmark and performance testing tool for MySQL database server.
Before installation, we can detect whether the system comes installed MySQL:
rpm -qa | grep mysql
If you have 40, you can choose to uninstall:
rpm -e mysql // delete common mode
rpm -e --nodeps mysql // strong delete mode, if you use the above command to delete, suggesting other files rely on, use the delete command can be strong
Install MySQL:
Next we use in Centos7 system command yum install MySQL, to note that CentOS 7 version of the MySQL database from the default list of programs removed, so we need to go before installing the official website to download Yum resource package, download address : https://dev.mysql.com/downloads/repo/yum/
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
yum install mysql-server
Permission settings:
chown mysql:mysql -R /var/lib/mysql
Initialization MySQL:
mysqld --initialize
Start MySQL:
systemctl start mysqld
View MySQL running state:
systemctl status mysqld
Note: If we are the first start mysql service, mysql server will first be configured to initialize.
In addition, you can use instead of MariaDB, MySQL MariaDB database management system is a branch, mainly by the open source community in the maintenance, under the GPL license. One reason for the development of this branch is: after Oracle's acquisition of MySQL, there are potential risks to MySQL closed source, so the branch community a way to avoid this risk.
MariaDB purpose is fully compatible with MySQL, including API and command line, so that it can easily become a substitute for MySQL.
yum install mariadb-server mariadb
Mariadb database related commands are:
systemctl start mariadb #启动MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重启MariaDB
systemctl enable mariadb # Set boot

Verify MySQL installation

After a successful installation of MySQL, the table will list some basic initialization, after the server is started, you can verify that MySQL is working correctly by simple tests.
Use mysqladmin tool to get the server status:
Use mysqladmin command to check the server version of linux on the binary file is located in / usr / bin directory on the Windows binary file is located in C: \ mysql \ bin.
[root@host]# mysqladmin --version
On the linux command outputs 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 does not output any information after the execution, state your Mysql is not installed successfully.

Execute simple SQL commands to use MySQL Client (Mysql client)

You can use the MySQL Client (Mysql client) mysql command to connect to the MySQL server, default login password for the MySQL server is empty, so in this instance is not required to enter 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 need to do after installation

Mysql After successful installation, the default root user password is empty, you can create the root password, use the following command:
[root@host]# mysqladmin -u root password "new_password";
Now you can connect to Mysql server with the following command:
[root@host]# mysql -u root -p
Enter password:*******

Guess you like

Origin www.cnblogs.com/vilenx/p/12452556.html