1. Download the installation package
Download. RPM Format installation package, requires the following two files:
mysql-server-5.0.26-0.i386.rpm
mysql-client-5.0.26-0.i386.rpm
Note: When the official website downloads, if chooses the Linux generic edition, but the webpage does not jump to the corresponding installation package download page, please to the mirror website to download, may Baidu Sohu image.
2. Check that you have installed
[Email protected] ~]# Rpm-qa | Grep-i MySQL
Mysql-libs-5.1.61-4.el6.x86_64
Indicates that the library file has been installed and should be uninstalled before overwriting errors occur.
[Email protected] ~]# rpm-e--nodeps mysql-libs-5.1.61-4.el6.x86_64
3. Install the MySQL server
Run the following command in a directory with two RMP files:
[[Email protected] ~] #rpm-IVH mysql-server-5.5.29-2.el6.x86_64.rpm
Once the installation is complete, a MySQL group is automatically added to Linux, and the MySQL group user mysql can be viewed by the ID command.
[[email protected] ~]# ID mysql
uid=496 (MySQL) gid=493 (MySQL) groups=493 (MySQL)
MySQL server installed after the installation of the relevant files, but did not automatically start the MySQL service, need to start manually.
@tianxia ~]# service MySQL start
Starting MySQL ...... ..... ....................... [OK]
Note: When installing the server, the installation process information will show the initial random password under which file
3. Install the MySQL client
[[Email protected] ~] #rpm-IVH mysql-client-5.5.29-2.el6.x86_64.rpm
If the installation is successful, you can log in to MySQL, and the command is mysql,mysql using the following syntax:
MySQL [-u username] [-h host] [-p[password]] [dbname]
Username and password are mysql user name and password, MySQL's initial management account is root, no password
Note: This root user is not a Linux system user. MySQL Default user is root, the first time to enter only need to type MySQL (as if the first time not to enter a password, if necessary, vi initial random password file)
[email protected] ~]# MySQL
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 2
Server version:5.6.24 MySQL Community Server (GPL)
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
4.linux MySQL to change the root password (here root is the MySQL default user)
Method One: Use the Set password command
Log in to MySQL first
Mysql-u root-p
Then execute the Set password command
Set password for [email protected] = password (' 123456 ');
Method Two: Use Mysqladmin
Format: mysqladmin-u root-p password New password
Mysqladmin-u root-p Password 654321
You will be prompted to enter your old password, then you can complete the change password
Method Three: Change the user table for MySQL
Log in to MySQL first
Mysql-u root-p
Then manipulate the user table of the MySQL library to update
mysql> use MySQL;
mysql> Update use Set Password=password (' 123456 ') where user= ' root ' and host= ' localhost '
mysql> flush Privileges;
Method Four: In case of forgetting the password
First stop the MySQL service
Service MySQL Stop
Start MySQL in a way that bypasses authorization
Mysqld_safe
Log in as root user MySQL
Mysql-u Root
Manipulate the user table of the MySQL library to update
mysql> use MySQL;
mysql> Update user Set Password=password (' 123456 ') where user= ' root ' and host= ' localhost '
mysql> flush Privileges;
Mysql> quit
Restart MySQL Service
Service MySQL Restart
Installing MySQL in rpm format under Linux