Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1159  / 2 Years ago, thu, november 18, 2021, 9:36:57

I'm trying to setup ownCloud in a test lab. I somehow managed to create a 'owncloud' user (which is fine). The account has an empty password (I'm not sure how that happened), so I'm trying to set one:



MySQL and 'No Current User' after logging in as a user



For reasons that I don't understand (I'm not a database guru), the database is telling me there's no current user even though I logged in using the 'owncloud' test account.



Any ideas how to make MySQL behave as expected?



EDIT: I was wrong about the user 'owncloud'. It was not created though the ownCloud setup (I think I confused the server's name ('owncloud') with the user ('owncloud') because I expected it to be there).



New question: how in the world could I successfully log in under a non-existent user account?


More From » mysql

 Answers
5

The following result of the CURRENT_USER()


mysql> SELECT CURRENT_USER();
+----------------+
| CURRENT_USER() |
+----------------+
| @localhost |
+----------------+
1 row in set (0.00 sec)

says that you're currently using the database as anonymous user. A freshly installed MySQL db has the following user entries in its mysql.user table:


mysql> SELECT user,host,password from mysql.user;
+------------------+-----------------+-------------------------------------------+
| user | host | password |
+------------------+-----------------+-------------------------------------------+
| root | localhost | *........................................ |
| root | xxxx | *........................................ |
| root | 127.0.0.1 | *........................................ |
| root | ::1 | *........................................ |
| | localhost | |
| | xxxxx | |
| debian-sys-maint | localhost | *........................................ |
+------------------+-----------------+-------------------------------------------+
7 rows in set (0.00 sec)

There are some root accounts (password-secured) and two anonymous accounts allowing a logon from localhost (the xxxxx entry is the machine's hostname).


If there's an entry in the user table lacking username and password, the following rule applies:



If the User value is blank, it matches any user name. If the user
table row that matches an incoming connection has a blank user name,
the user is considered to be an anonymous user with no name, not a
user with the name that the client actually specified.
This means that
a blank user name is used for all further access checking for the
duration of the connection (that is, during Stage 2).


(see the MySQL docs, "6.2.4. Access Control, Stage 1: Connection Verification")



In general, after installing MySQL, you should take notice of the following part of the documentation: "2.11.2. Securing the Initial MySQL Accounts".


[#27757] Friday, November 19, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
utilitere

Total Points: 394
Total Questions: 110
Total Answers: 114

Location: Solomon Islands
Member since Wed, Mar 29, 2023
1 Year ago
;