MySQL создает полномочия базы данных и пользователь

Я просто протестировал этот URI на нашей компании Exchange Server. Мне подарили диалоговое окно входа в систему, и после ввода моих учетных данных, веб-сервис возвратил ответ XML.

Вы получаете диалоговое окно входа в систему, или оно сразу перенаправляет к 403 страницам?

Вы могли попытаться проверить конфигурацию веб-сервисов Exchange при помощи управления Exchange Shell, при помощи теста -* cmdlets. Подробная статья здесь: Тестирование Exchange 2007 С PowerShell (Часть 1)

Не уверенный, если этот поможет Вам, но это - очень крутой инструмент тестирования: :) https://www.testexchangeconnectivity.com/

1
задан 21 January 2013 в 06:57
2 ответа

В данный момент, на основе комментариев ниже, я думаю, что проблема то, что creator у пользователя нет разрешений, которые это пытается дать к newuser учетная запись.

Согласно документации,

Вы не можете предоставить другому пользователю полномочие, которое Вы сами не имеете

Таким образом, я понимаю Ваше требование иметь creator учетная запись имеет как можно меньше полномочий, но это не то, как модель полномочия MySQL работает; ПРЕДОСТАВИТЬ ВСЕ на newdb.* к newuser создателю также будут нужны ВСЕ на newdb.*, а также полномочие ПРЕДОСТАВЛЕНИЯ.

0
ответ дан 3 December 2019 в 22:21

The problem here is very straightforward. Look at the order of things:

mysql -u$myuser -p$mypass -rs -e "CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$dbpass';";
mysql -u$myuser -p$mypass -rs -e "GRANT USAGE ON *. * TO '$dbuser'@'localhost' IDENTIFIED BY '$dbpass' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;";
mysql -u$myuser -p$mypass -rs -e "CREATE DATABASE IF NOT EXISTS $dbname ;";
mysql -u$myuser -p$mypass -rs -e "GRANT ALL PRIVILEGES ON $dbname . * TO '$dbuser'@'localhost';";
mysql -u$myuser -p$mypass -rs -e "FLUSH PRIVILEGES ;";

The first three(3) lines cannot be performed by $myuser because . A superuser (such as root@localhost) must perform the first three lines.

Here is something additional: Only root@localhost can perform FLUSH PRIVILEGES;. However, it is not even necessary because the GRANT command internally performs FLUSH PRIVILEGES;.

With these things in mind, this is how you can create new users with its own database:

rootuser=root
rootpass=rootpassword
myuser=creator
mypass=xxxx
dbuser=newuser
dbname=newdb

mysql -u$rootuser -p$rootpass -rs -e "CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$dbpass';";
mysql -u$rootuser -p$rootpass -rs -e "GRANT USAGE ON *.* TO '$dbuser'@'localhost' IDENTIFIED BY '$dbpass' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;";
mysql -u$rootuser -p$rootpass -rs -e "CREATE DATABASE IF NOT EXISTS $dbname ;";
mysql -u$rootuser -p$rootpass -e "GRANT ALL PRIVILEGES ON $dbname . * TO '$dbuser'@'localhost';";

If you seriously do not want to user root@localhost, create the user as follows:

Step 01) As root@localhost, login to mysql and run

SELECT PASSWORD('creatorpassword');

This will return a 41-character MD5-like string.

Step 02) As root@localhost, login to mysql and run

SET SQL_LOG_BIN=0;
GRANT ALL PRIVILEGES ON *.* to creator@localhost IDENTIFIED BY PASSWORD '41-character MD5-like string';

This creates the user and sets his password. The first line SET SQL_LOG_BIN=0 simply prevents the command from being recorded in the binary logs if you have binary logging enabled.

Step 03) Remove the commands from the audit history of mysql.

Every time you login to mysql, the commands are recorded in a file called .mysql_history. Run ths

cd
vi .mysql_history

Once you enter into vi, run /SELECT PASSWORD, hit enter. This will place you at the line where the command to print the PASSWORD function from text was done. Simply hit dd and ZZ, and you are done.

Going forward, you can user creator@localhost with the same rights as root@localhost and you have hidden the password well. You will just have to maintain its integrity.

2
ответ дан 3 December 2019 в 22:21

Теги

Похожие вопросы