Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting dolt as a sql server specifying user and host parameter creates a user at the host as defined. This should be the % default. #4079

Closed
chrisfw opened this issue Aug 15, 2022 · 19 comments
Assignees
Labels
bug Something isn't working

Comments

@chrisfw
Copy link

chrisfw commented Aug 15, 2022

Specifying the -u command line parameter no longer works. Dolt version 0.40.25 . I kept working my way backward through earlier releases to finally make it work as documented (version .39.5)

 Main PID: 30022 (dolt)
   CGroup: /system.slice/doltdb.service
           └─30022 /usr/local/bin/dolt sql-server -H10.1.6.210 -uroot

dolt_conn_user_not_found_error

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 15, 2022

Did you create additional users?

Once you create additional users, the defined system user is deleted.

@chrisfw
Copy link
Author

chrisfw commented Aug 15, 2022

@timsehn , thanks for your quick response. I did not create any users. This was the result of just starting the server with the command line parameter for host and user. I tried specifying with a password and that did not work either. I neglected to mention that I am working on Linux, though that likely should not make a difference.

Thanks,
Chris

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 15, 2022

OK. @jcor11599 will try and reproduce today.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 15, 2022

I can't reproduce on the command line.

In one shell:

us-housing-prices $ dolt sql-server
Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="info"
2022-08-15T09:40:24-07:00 INFO [conn 1] NewConnection {DisableClientMultiStatements=false}

Other shell:

us-housing-prices $ mysql -h 127.0.0.1 -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.9-Vitess 

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| us_housing_prices  |
+--------------------+
2 rows in set (0.000 sec)

MySQL [(none)]>

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 15, 2022

Also specifying -uroot to dolt sql-server allows me to connect as well.

Cus-housing-prices $ dolt sql-server -uroot
Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="info"
2022-08-15T09:51:20-07:00 INFO [conn 1] NewConnection {DisableClientMultiStatements=false}

Other shell

us-housing-prices $ mysql -h 127.0.0.1 -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.9-Vitess 

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| us_housing_prices  |
+--------------------+
2 rows in set (0.000 sec)

What tool are you using to connect? That too may be running commands on startup that are confusing Dolt.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 15, 2022

I can also get the dolt sql-server to respond to the -u.

In one shell:

us-housing-prices $ dolt sql-server -ufoo
Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="info"
2022-08-15T09:55:22-07:00 INFO [conn 1] NewConnection {DisableClientMultiStatements=false}
2022-08-15T09:55:50-07:00 INFO [conn 1] ConnectionClosed {}

Other shell:

us-housing-prices $ mysql -h 127.0.0.1 -ufoo
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.9-Vitess 

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| us_housing_prices  |
+--------------------+
2 rows in set (0.000 sec)

MySQL [(none)]> exit
Bye
us-housing-prices $ mysql -h 127.0.0.1 -uroot
ERROR 1045 (28000): User not found 'root'

@zachmu
Copy link
Member

zachmu commented Aug 15, 2022

@timsehn , thanks for your quick response. I did not create any users. This was the result of just starting the server with the command line parameter for host and user. I tried specifying with a password and that did not work either. I neglected to mention that I am working on Linux, though that likely should not make a difference.

Can we see the connection string / configuration dialog for the GUI you're using?

@chrisfw
Copy link
Author

chrisfw commented Aug 15, 2022

@zachmu and @timsehn

I am using DBeaver with the MySQL 5 Driver (I also tried with a newer MySQL driver version).

conn-string

@chrisfw
Copy link
Author

chrisfw commented Aug 15, 2022

FYI @timsehn and @zachmu
I tried it again just starting from the command line at trace level and connecting from dbeaver with the same connection settings and the addition of the specified password with the same unsuccessful result. Unfortunately, trace doesn't really provide any additional useful detail.

dolt-sql-server-trace

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 15, 2022

Thanks, we're still digging. It works as intended pre 0.39.5 correct?

@chrisfw
Copy link
Author

chrisfw commented Aug 16, 2022

@timsehn 0.39.5 works with DBeaver and I believe earlier versions do as well but I haven’t confirmed.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 16, 2022

I think I found the bug.

When you run the server like so:

dolt_new $ dolt sql-server -H 127.0.0.1 -u root

It rewrites the mysql db to have the user like so:

MySQL [(none)]> select user,host from mysql.user;
+---------+-----------+
| User    | Host      |
+---------+-----------+
| timsehn | %         |
| weak    | %         |
| root    | 127.0.0.1 |
+---------+-----------+

So, in your case it's only allowing connections as root from the IP 10.1.6.210.

I'm not sure how MySQL works in this case but I presume what we want is to just use the % default for Host if a user is created on server startup.

@timsehn timsehn changed the title Starting dolt as a sql server specifying user parameter does not work in newer version as documented Starting dolt as a sql server specifying user and host parameter creates a user at the host as defined. This should be the % default. Aug 16, 2022
@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 16, 2022

I think you can work around this by starting the server like so:

/usr/local/bin/dolt sql-server -uroot

I don't think -H does what you want in this case.

We're discussing internally whether we want that option at all because mysqld does not have it.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 16, 2022

We're going to make -H not apply to the user permissions. This will get fixed today by @jcor11599.

@chrisfw
Copy link
Author

chrisfw commented Aug 16, 2022

@timsehn , sounds great, thank you! It was great chatting with you, @zachmu and Brian today. Talk soon.
Regards,
Chris

@chrisfw
Copy link
Author

chrisfw commented Aug 17, 2022

@jcor11599 , would you mind giving me a heads up when the change mentioned by @timsehn has been incorporated into a new release?

Thanks,
Chris

@timsehn timsehn added the bug Something isn't working label Aug 17, 2022
@jycor
Copy link
Contributor

jycor commented Aug 17, 2022

@chrisfw, change is merged to main; and currently running a release. Will let you know when dolt 0.40.27 it's out!

@jycor
Copy link
Contributor

jycor commented Aug 18, 2022

@chrisfw dolt 0.40.27 is out!

@jycor jycor closed this as completed Aug 18, 2022
@chrisfw
Copy link
Author

chrisfw commented Aug 18, 2022

@jcor11599 , thank you very much! I really appreciate you completing this so quickly.

Regards,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants