Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deal with some sql error after starting mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to deal with a certain sql error after starting mysql". In the daily operation, I believe that many people have doubts about how to deal with some sql error after starting mysql. The editor consulted all kinds of data and sorted out a simple and useful method of operation. I hope it will be helpful to answer the doubt of "how to deal with a certain sql error after starting mysql". Next, please follow the editor to study!

After using the following command:

Docker run-p 3306 F:/docker/mysql/datadir:/var/lib/mysql 3306-- name jiuhao-mysql-v F:/docker/mysql/datadir:/var/lib/mysql-e MYSQL_ROOT_PASSWORD=123456-d mysql

After starting mysql, execute a sql and report the following error:

Expression # 1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Therefore, the configuration of mysql needs to be reconfigured to avoid it.

Use the following command to start mysql and specify the directory for the custom configuration:

Docker run-p 3306 F:/docker/mysql/datadir:/var/lib/mysql 3306-- name jiuhao-mysql-v F:/docker/mysql/datadir:/var/lib/mysql-v F:/docker/mysql/conf:/etc/mysql/conf.d-e MYSQL_ROOT_PASSWORD=123456-d mysql

The key is-v F:/docker/mysql/conf:/etc/mysql/conf.d. Map a directory of the host to the conf.d directory in the container, and the mysql in the container will load all the configurations under this directory. If the-v mount is not, please set the host hard disk sharing. As shown below:

Can be used

Winpty docker exec-it jiuhao-mysql bash

Check the directory under / etc/mysql.

Next, create a mysql configuration file under the host's F:/docker/mysql/conf directory with a custom name, using my.cnf as the file name. The configuration is as follows:

[mysqld] sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Sql_mode can be modified according to its own needs.

Finally, restart the container:

Docker restart jiuhao-mysql

At this point, the study on "how to deal with some sql error after starting mysql" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report