CentOS Yum install MySQL online and detailed configuration steps

Source: Internet
Author: User
Tags flush mysql in centos mysql login

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.