1. Uninstall the original mysql:
Uninstall 1:
Input:
# Rpm-qa | grep-I mysql
Display:
Mysql-libs-5.1.52-1.el6_0.1.i686
Uninstall method:
Yum-y remove mysql-libs-5.1.52-1.el6_0.1.i686
Uninstall 2:
Input:
# Rpm-qa | grep-I mysql
Display:
MySQL-client-5.1.62-1.glibc23.i386
MySQL-server-5.1.62-1.glibc23.i386
Uninstall method:
# Rpm-ev MySQL-client-5.1.62-1.glibc23.i386 MySQL-server-5.1.62-1.glibc23.i386
Ii. Install the MySQL server:
Installation: MySQL-server-5.1.62-1.glibc23.i386.rpm
# Rpm-ivh/software/mysql/MySQL-server-5.1.62-1.glibc23.i386.rpm
This is generating some files under the/usr/share/mysql directory, with a file named: my-medium.cnf to copy it to/etc/my. cnf
# Cp/usr/share/mysql/my-medium.cnf/etc/my. cnf
Now the installation is complete. You can check the running process:
# Ps-ef | grep mysql
3. Install the MySQL client:
# Rpm-ivh/software/mysql/MySQL-client-5.1.62-1.glibc23.i386.rpm
Now the client is successfully installed. You can check some MySQL files:
# Ls/usr/bin/mysql *
4. log on to mysql:
There is no password at the beginning of mysql installation. Enter:
# Mysql
You can log on to the mysql database.
5. Set the MySQL password:
# Mysqladmin-u root password 123456
In this way, set the username in mysql as the root password to 123456.
6. log on to mysql with a password:
The command is the same as logging on to mysql under dos:
# Mysql-uroot-p123456
Or
# Mysql-uroot-p [Press enter]
Enter the password again.