Background: I am running a cqpweb, a corpus query interface written in PHP and connected to a mysql database, on an Apache2 webserver under Ubuntu 18.04 LTS. The Ubuntu server was set up from scratch and there are currently no manual configurations to mysql or php.

cqpweb ran happily unless it started throwing out error messages like this one:

 A MySQL query did not run successfully!

 Original query: LOAD DATA LOCAL INFILE '/data2/cqpweb/cach/tab_dist_fycel9oplk' INTO TABLE `db_dist_g2f3ndxf40` FIELDS ESCAPED BY '' /* from User: knappen |
 Function: create_db() | 2019-Apr-25 11:23:01 */

 Error # 0:

This happened overnight, no updates or other changes to the system occurred except for a grace restart of the Apache http server by a daily cron job.

The very strange thing is that when I log into the mysql database using the same database user as the webserver and cut&paste the query into mysql, it works. The difference is only the UNIX user: In case of the webserver, the user www-data, in case of the login me (as a normal user not using my sudo priviledge).

Question Is mysql sensitive to the UNIX user before the login, and if yes, what does influence the behaviour of mysql here (some environment variables?)? Is there a difference between interactive and non-interactive?

Related question with other aspacts of the same underlying problem:

What are size limits for mysql on Ubuntu 18.04 and how can I increase them?

Was there some kind of Ubuntu upgrade that can cause this kind of behaviour?

EDIT: Excluded AppArmor as a potential culprit, disabling AppArmor and restarting Apache2 does not change the behaviour.

EDIT2: The user is question has mysql_native_password as plugin, not auth_socket.

  • MySQL can be sensitive to the username only if it is configured to use auth_socket method. See askubuntu.com/questions/1105970/… I would guess more likely case is that you haven't granted www-data user privileges to edit the database – Sergiy Kolodyazhnyy Apr 30 at 11:19
  • Checked the authentication method (see EDIT2), it isn't auth_socket. The user in question, cqpwebAdmin, has been granted all on the cqpweb database, and it has been granted FILE on *.*. Note that it worked before Apr 25, and it works when I log in with the very same user interactively. – jknappen Apr 30 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.