MySQL User – Create a Domain Account User in MySQL

MySQL

I am from MSSQL background and trying to learn MYSQL on a windows server 2012 VM. I want to create a user in MYSQL and the user is also a domain account. Please give me the script to get it done or is it a limitation of MYSQL.

CREATE USER 'domain\abc'@'%' IDENTIFIED BY 'password';

If I try the above command then it's creating a user by name 'domainabc' in mysql

Best Answer

By default, MySQL server accounts, with the default authentication plugin, are completely unrelated to system or network users. That means that (again, stress on by default), whenever you run: CREATE USER you are creating a mysql-only account, no matter if it has the same name than other system (os) or authentication methods.

However, MySQL has available authentication plugins, which you can enable on a per-account basis, and link it, for example, to OS accounts or LDAP/domain network accounts.

I am personally not familiar with Microsoft Authentication methods (I am myself a Linux administrator, so I only familiar with plugins such as unix_socket and PAM) but a quick search tells me that such plugins indeed exist:

https://dev.mysql.com/doc/refman/5.5/en/windows-pluggable-authentication.html

I can even see MySQL installed on Linux servers using PAM to authenticate using windows servers:

https://runops.wordpress.com/2015/03/19/how-to-setup-active-directory-authentication-in-mysql-running-on-linux/

If you were unsuccessful with trying those, or don't want to pay for them, you could setup an external utility to sync domain users with MySQL local users.