Skip to content

Commit 36b4d38

Browse files
committed
🚧 MySQL
1 parent 0502fea commit 36b4d38

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

markdown-file/Mysql-Install-And-Settings.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ table_open_cache=256
192192
- 在终端中执行(CentOS 7):`systemctl stop mysql`
193193
- 在终端中执行(前面添加的 Linux 用户 mysql 必须有存在):`/usr/local/mysql/bin/mysqld --skip-grant-tables --user=mysql`
194194
- 此时 MySQL 服务会一直处于监听状态,你需要另起一个终端窗口来执行接下来的操作
195-
- 在终端中执行:`mysql -u root mysql`
195+
- 在终端中执行:`mysql -u root mysql` 或者:`mysql -h 127.0.0.1 -u root -P 3306 -p`
196196
- 把密码改为:123456,进入 MySQL 命令后执行:`UPDATE user SET Password=PASSWORD('123456') where USER='root';FLUSH PRIVILEGES;`
197197
- 然后重启 MySQL 服务(CentOS 6):`service mysql restart`
198198
- 然后重启 MySQL 服务(CentOS 7):`systemctl restart mysql`
@@ -221,6 +221,24 @@ set password = password('新密码');
221221
FLUSH PRIVILEGES;
222222
```
223223

224+
## MySQL 5.7
225+
226+
- 报错内容:
227+
228+
```
229+
Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'youmeek.nm.id'
230+
which is not functionally dependent on columns in GROUP BY clause;
231+
this is incompatible with sql_mode=only_full_group_by
232+
```
233+
234+
- 查下自己的模式:`select version(), @@sql_mode;`
235+
- 解决办法,修改 my.cnf,增加这一行:
236+
237+
```
238+
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION;
239+
```
240+
241+
224242
## 小内存机子,MySQL 频繁挂掉解决办法(1G + CentOS 7.4)
225243

226244
- 保存系统日志到本地进行查看:`cd /var/log/ && sz messages`

0 commit comments

Comments
 (0)