|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, January 21, 2013 7:15 PM
Points: 2,
Visits: 12
|
|
I am installing a product which needs a database - it can use any database as long as there is a jdbc connector available for it. However, the installation guide has instructions only on how to make it work with MySQL.
I am running it with SQL Server Express.
These are the instructions for MySQL
CREATE DATABASE proddb; CREATE USER 'proddb'@'%' IDENTIFIED BY 'thepassword'; CREATE USER 'proddb'@'localhost' IDENTIFIED BY 'thepassword'; USE proddb; GRANT ALL PRIVILEGES ON *.* TO 'proddb'@'localhost' IDENTIFIED BY 'thepassword'; GRANT ALL PRIVILEGES ON *.* TO 'proddb'@'%' IDENTIFIED BY 'thepassword'; FLUSH PRIVILEGES;
The CREATE DATABASE statement works fine on SQL Server.
However, the next statement chokes. It seems like the db name shouldn't be in quotes in SQL Server. However, I am not sure what is the equivalent for '%' in SQL Server. Likewise for 'proddb'@'localhost'.
SQL Server also chokes on *.* in the GRANT statement.
Can someone help me convert all these statements to the equivalent statements for SQL Server?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:24 PM
Points: 6,826,
Visits: 11,950
|
|
vuser (1/21/2013) I am installing a product which needs a database - it can use any database as long as there is a jdbc connector available for it. However, the installation guide has instructions only on how to make it work with MySQL.
I am running it with SQL Server Express.
These are the instructions for MySQL
CREATE DATABASE proddb; CREATE USER 'proddb'@'%' IDENTIFIED BY 'thepassword'; CREATE USER 'proddb'@'localhost' IDENTIFIED BY 'thepassword'; USE proddb; GRANT ALL PRIVILEGES ON *.* TO 'proddb'@'localhost' IDENTIFIED BY 'thepassword'; GRANT ALL PRIVILEGES ON *.* TO 'proddb'@'%' IDENTIFIED BY 'thepassword'; FLUSH PRIVILEGES;
The CREATE DATABASE statement works fine on SQL Server.
However, the next statement chokes. It seems like the db name shouldn't be in quotes in SQL Server. However, I am not sure what is the equivalent for '%' in SQL Server. Likewise for 'proddb'@'localhost'.
SQL Server also chokes on *.* in the GRANT statement.
Can someone help me convert all these statements to the equivalent statements for SQL Server? MySQL requires you provide not only a username (e.g. proddb) but also the source IP address (or mask) it can connect from. SQL Server security does not care about source IP. If you need IP restrictions for logins you must implement your own mechanism within a LOGIN TRIGGER. Another difference is that SQL Server has Server Logins and Database Users where MySQL only has Users.
This in MySQL:
CREATE USER 'proddb'@'%' IDENTIFIED BY 'thepassword';
Would be this in SQL Server:
USE master; CREATE LOGIN proddb WITH PASSWORD = 'thepassword', DEFAULT_DATABASE = [thedatabasename]; USE thedatabasename; CREATE USER [proddb] FROM LOGIN [proddb]; -- here the username can be different from the login name, your choice
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|