Showing posts with label db. Show all posts
Showing posts with label db. Show all posts

Monday, February 3, 2014

MYSQL: GRANT ACCESS to DATABASE


GRANT ALL PRIVILEGES on db.* to 'username'@'applicationserverhost' IDENTIFIED BY 'password'

..

Thursday, October 18, 2012

MySQL: Grant mssql user in mssql db

Copy from : http://techovdoom.blogspot.com/2012/06/grant-mssql-user-in-mssql-db.html

Thanks John.

Configuring user permissions for Microsoft SQL Server
Microsoft SQL Server defines SQL Server Agent roles that govern accessibility of the job framework. The SQL Server Agent jobs are stored in the SQL Server msdb database.

To install Websense Log Server successfully, the user account that owns the Websense database must have membership in one of the following roles in the msdb database:
*
SQLAgentUserRole
*
SQLAgentReader Role
*
SQLAgentOperator Role
The SQL user account must also be a member of the dbcreator fixed server role.
Use Microsoft SQL Server Management Studio to grant the database user account the necessary permissions to successfully install Log Server.
1.
On the SQL Server machine, go to Start > Programs > Microsoft SQL Server 2005 or 2008 > Microsoft SQL Server Management Studio.
2.
Select the Object Explorer tree, and then go to select Security > Logins.
3.
Select the login account to be used during the installation.
4.
Right-click the login account and select Properties for this user.
5.
Select User Mapping and do the following:
a.
Select msdb in database mapping.
b.
Grant membership to one of these roles:
*
SQLAgentUserRole
*
SQLAgentReader Role
*
SQLAgentOperator Role
c.
Click OK to save your changes.
6.
Select Server Roles, and then select dbcreator. The dbcreator role is created.
7.
Click OK to save your changes.

Sunday, May 3, 2009

Change Mysql Database Prefix..

dari: Sifoo Sirap

1. Go into mysql...then show tables;

2. Copy all tables that you want to rename ...

3. Paste in this script (eg:save the file as batch_rename.sh ) :

OLD_PREFIX = "mdl"

NEW_PREFIX = "mdlsirap"

data=
<<-EOD
| mdl_assignment |
| mdl_assignment_submissions |
| mdl_backup_config |
| mdl_backup_courses |
| mdl_backup_files |
| mdl_backup_ids |
| mdl_backup_log |
| mdl_block |
| mdl_block_instance |
| mdl_block_pinned |
EOD
tables = []
data.each_line do |line|
if line=~/(#{OLD_PREFIX}\w+)/
puts "RENAME TABLE #{$1} TO #{NEW_PREFIX}#{$1};"
end
end


4. Then run this script using ruby command-line (I assume you already install ruby) :
# ruby batch_rename.sh

5. The output :
RENAME TABLE mdl_assignment TO mdlsirap_assignment;
RENAME TABLE mdl_assignment_submissions TO mdlsirap_assignment_submissions; RENAME TABLE mdl_backup_config TO mdlsirap_backup_config;
RENAME TABLE mdl_backup_courses TO mdlsirap_backup_courses;
RENAME TABLE mdl_backup_files TO mdlsirap_backup_files;
RENAME TABLE mdl_backup_ids TO mdlsirap_backup_ids;
RENAME TABLE mdl_backup_log TO mdlsirap_backup_log;
RENAME TABLE mdl_block TO mdlsirap_block;
RENAME TABLE mdl_block_instance TO mdlsirap_block_instance;
RENAME TABLE mdl_block_pinned TO mdlsirap_block_pinned;

6. Just masukan sql statement ni dlm satu file lain...tapi kalau nak senang...buat step no. 4 tu camni :
# ruby batch_rename.sh > a.sql

7. Run the sql file using mysql...:
# mysql -uroot -p namadatabase < style="color: rgb(255, 0, 0);">**Check balik dalam database, prefix semua table dah bertukar.

8. Done