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

来源:互联网 发布:linux如何安装bind 编辑:程序博客网 时间:2024/05/17 03:08
[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/mysqlmysql -u root mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -AWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.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 1mysql> update user set password=PASSWORD('guo') where USER='root';Query OK, 4 rows affected (0.00 sec)Rows matched: 4  Changed: 4  Warnings: 0mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> quit;Bye[root@ws1m mysql]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.31Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.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 statementmysql> 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.00 sec)mysql> flush privileges;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 restartShutting 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: 0mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> quit;Bye#先测试下以ws1m 远程连接行不行[root@ws1m ~]# mysql -h ws1m -u root -p
0 0