1. Check CentOS's own MySQL
Yum list installed | grep mysql
2. Delete CentOS's own MySQL
# when the results are displayed as complete! That is, uninstall completed
yum-y remove mysql-libs.x86_64
3. Check the version number of MySQL in the Yum library
Yum list|grep mysql
# or use
yum-y list mysql*
4.yum online install mysql
yum-y install mysql-server mysql mysql-devel
5. Check for MySQL installation
Rpm-qi Mysql-server
6. Start MySQL Services
Service mysqld start
# Start Service
# Restart restart Service
# Stop Service
# Status Service status
7. Modify login password and access rights
#登录, by default MySQL login does not have password
MySQL
#选择数据库
mysql> use MySQL;
#修改root登录密码
Mysql> upd Ate user set Password=password ("123456") where user= ' root ';
#修改host访问权限 to troubleshoot other machine access issues
mysql> Update user set host= '% ' where host= ' localhost ';
#刷新配置
mysql> flush P Rivileges;
#退出
Mysql> quit
# Log in again
Mysql-uroot-p
Enter Password:
Mysql>
When the settings are incorrect and cannot be logged on
Report Error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using password:no) errors, the solution is as follows:
#1. Stop MySQL Database
/etc/init.d/mysqld stop
#2. Execute the following command
Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
#3. Log in to the MySQL database using root
Mysql-u Root MySQL
#4. Update Root password
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
#5. Refreshing permissions
mysql> FLUSH privileges;
#6. Exit MySQL
Mysql> quit
#7. Restart MySQL
/etc/init.d/mysqld restart
#8. Re-logon to MySQL with root user
Mysql-uroot-p
Enter Password: < Enter the new password newpassword>