February 2

MSSQL: Maintenance plan is not deleting the backup files

There are a few reasons that this task may fail, but one of the most common is the follow:
In Maintenance Cleanup Tasks, check to make certain the file extension entered is bak and not .bak.
Save your change and then test it.
It is normal to put a “.” then the file type in most search type functions, but the “.” in MSSQL will make it so nothing is deleted.

 

Category: Databases | Comments Off on MSSQL: Maintenance plan is not deleting the backup files
December 4

Sybase: Hacking Sybase/MS-SQL for the NT Administrator

We were recently faced with getting into a Sybase database where we had fully authorized Administrator access to the NT system, but everybody who knew the “sa” password was long gone. We positively needed the data, so we found a way in, and we’re recording this here so we don’t forget how we did this. We also hope to save others some time — we spent the better part of a day fooling with this, and it could have all been much easier had we known.

The machine in question ran NT Server 4.0 with SP4, and Sybase version 11, but we suspect that this approach would work for newer versions too. We’d also not be surprised if this worked for Microsoft SQL server as well.

Like Microsoft’s SQL server, Sybase permits three modes of authentication:

Standard security mode
Standard security mode is where Sybase maintains its own user database — with login names, passwords, and access rights — and is probably the default. In this mode, the NT user accessing the server is never considered, so being an NT Administrator doesn’t give you any special access.
Integrated security mode
This mean that authenticated NT logons map to Sybase logons, so once you’ve passed the NT domain logon process, that credential gets you into the Sybase door as well. The mapping is not automatic: the DB administrator has to set up the NT -> Sybase user mappings explicitly and then grant rights to those mapped users. Its main benefit seems to be elimination of a separate database login step.
Mixed security mode
This is a hybrid of the previous two.

In “Integrated” security mode, there is further a method of translating otherwise unknown authentication attempts into a specific database user. Not all NT users necessarily map to a valid Sybase user, so the “DefaultLogon” is used to map unrecognized NT users into a single Sybase user. This could be used to provide a kind of generic “guest” access, and we believe that this is disabled by default.

We went into the registry under:

HKEY_LOCAL_MACHINESOFTWARESYBASEServerserver_name

where “server_name” is the name of the database server in question. A machine can run more than one database, and each is administered separately (they even have different NT services to manage).

Under this key, we set LoginMode to “1” and DefaultLogin to “sa” and restarted the associated NT service. From here we ran the Sybase SQL Central and connected while running as an otherwise unknown NT user. This was mapped to the “sa” account, and now we’re an administrator of the databse.

We added a “real” Sybase user with proper SA access, and we were careful to pick a good password: Sybase will allow anybody to use it. We then unwound our changes to the registry and restarted the Sybase service to put things back as we found them. With our new SA user we were able to extract our data.

Standard “Please behave yourself” plaintives apply.

By: S Friedl

Category: Databases | Comments Off on Sybase: Hacking Sybase/MS-SQL for the NT Administrator
September 25

MYSQL: Resetting the root user in MYSQL

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

1.stop mysql service with “service mysqld stop”
2.start mysql service with “/usr/local/mysql/bin/mysqld_safe –skip-grant-tables & ”
3.Login mysql with “mysql -u root -p”
4.These are finished in mysql command line:
USE mysql;
UPDATE user SET Password=PASSWORD(‘newpassword’) where USER=’root’;
FLUSH PRIVILEGES;
quit
5.restart mysql service with “service mysqld restart”

Now you can login with mysql -u root -p

By: ccieyezhu

Category: Databases | Comments Off on MYSQL: Resetting the root user in MYSQL
March 21

MYSQL: Basic user setup

Make a new user:
CREATE USER ‘newuser’@’localhost’ IDENTIFIED BY ‘password’;

Grant privileges:
GRANT ALL PRIVILEGES ON * . * TO ‘newuser’@’localhost’;

Flush privileges:
FLUSH PRIVILEGES;

How To Grant Different User Permissions
Here is a short list of other common possible permissions that users can enjoy.

ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)

CREATE- allows them to create new tables or databases

DROP- allows them to them to delete tables or databases

DELETE- allows them to delete rows from tables

INSERT- allows them to insert rows into tables

SELECT- allows them to use the Select command to read through databases

UPDATE- allow them to update table rows

GRANT OPTION- allows them to grant or remove other users’ privileges

Specific user permissions:
GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@’localhost’;

Revoke a user’s permissions
REVOKE [type of permission] ON [database name].[table name] TO ‘[username]’@‘localhost’;

Drop a user
DROP USER ‘username’@‘localhost’;

Test your user by exiting mysql
mysql -u username -p

By: digitalocean

Category: Databases | Comments Off on MYSQL: Basic user setup