centos中 mysql 5.7安装
Posted 范晨鹏的博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos中 mysql 5.7安装相关的知识,希望对你有一定的参考价值。
以免授权模式启动
编辑 /etc/my.cnf,添加以下内容:
linux环境中:vi /etc/my.cnf
在[mysql(和php搭配之最佳组合)d]配置段添加如下两行:
user=mysql
skip-grant-tables
保存退出编辑。
重新启动 mysqld.
service mysqld restart
使用 mysql免密码连接,修改密码和密码过期标志;
[[email protected] ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.16 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> select user(); mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) mysql> select user(); +--------+ | user() | +--------+ | [email protected] | +--------+ 1 row in set (0.00 sec) mysql>UPDATE mysql.user SET authentication_string=PASSWORD(‘[email protected]!‘),password_expired=‘N‘ where USER=‘root‘; Query OK, 1 rows affected, 0 warning (0.00 sec) mysql> exit Bye
正常连接:
[[email protected] ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.16 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>
以上是关于centos中 mysql 5.7安装的主要内容,如果未能解决你的问题,请参考以下文章