CentOS6.5离线安装mysql遇到的几个问题

前端之家收集整理的这篇文章主要介绍了CentOS6.5离线安装mysql遇到的几个问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_0@
[root@ws1m MysqL]# rpm -ivh MysqL-server-5.6.31-1.el6.x86_64.rpm MysqL-client-5.6.31-1.el6.x86_64.rpm MysqL-devel-5.6.31-1.el6.x86_64.rpm #先下载好这三个rpm包拷到服务器直接装

#装完不知道root密码
[root@ws1m MysqL]# /etc/init.d/MysqLd stop #如果MysqL启动了,也先关闭。
Shutting down MysqL..                                      [确定]
[root@ws1m MysqL]# MysqLd_safe --user=MysqL --skip-grant-tables --skip-networking &
[1] 10185
[root@ws1m MysqL]# 160930 03:50:30 MysqLd_safe Logging to '/var/lib/MysqL/ws1m.err'.
160930 03:50:30 MysqLd_safe Starting MysqLd daemon with databases from /var/lib/MysqL
MysqL -u root MysqL
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 1
Server version: 5.6.31 MysqL Community Server (GPL)

Copyright (c) 2000,2016,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MysqL> UPDATE user SET Password=PASSWORD('guo') where USER='root';
ERROR 1064 (42000): You have an error in your sql Syntax; check the manual that corresponds to your MysqL server version for the right Syntax to use near ''guo') where USER='root'' at line 1
MysqL> update user set password=PASSWORD('guo') where USER='root';
Query OK,4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

MysqL> flush privileges;
Query OK,0 rows affected (0.00 sec)

MysqL> quit;
Bye
[root@ws1m MysqL]# MysqL -uroot -p
Enter password: 
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 2
Server version: 5.6.31

Copyright (c) 2000,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MysqL> create database ambari  DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
MysqL> set password=password('guo');
Query OK,0 rows affected (0.00 sec)

MysqL> create database ambari  DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
MysqL> grant all privileges on *.* to 'root'@'%' identified by 'guo' with grant option;
Query OK,0 rows affected (0.00 sec)

MysqL> flush privileges;
Query OK,0 rows affected (0.00 sec)

MysqL> grant all privileges on *.* to 'root'@'localhost' identified by 'guo' with grant option;
Query OK,0 rows affected (0.01 sec)

MysqL> quit;
Bye
#报错的原因有很多,一定要看日志。
ERROR: Exiting with exit code 1. 
REASON: Database check Failed to complete. Please check /var/log/ambari-server/ambari-server.log and /var/log/ambari-server/ambari-server-check-database.log for more information.

#查看日志提示密码过时,修改密码
MysqL> use MysqL; 
MysqL> update user set password=password('guo') where user='root'; 
MysqL> 状态下输入 FLUSH PRIVILEGES; 
回显 
Query OK,0 rows affected (0.00 sec) 
MysqL> 状态下输入 quit 
#重启MysqL
[root@ws1m ~]# service MysqL restart
Shutting down MysqL..                                      [确定]
Starting MysqL.                                            [确定]

#把password_expired 改成不过期
MysqL> use MysqL;

MysqL> update user set password_expired='N' where User='root';
Query OK,3 rows affected (0.00 sec)
Rows matched: 5  Changed: 3  Warnings: 0

MysqL> flush privileges;
Query OK,0 rows affected (0.00 sec)

MysqL> quit;
Bye

#先测试下以ws1m 远程连接行不行
[root@ws1m ~]# MysqL -h ws1m -u root -p
原文链接:https://www.f2er.com/centos/380531.html

猜你在找的CentOS相关文章