secure a mongo instance with client access control

https://docs.mongodb.com/v2.6/tutorial/enable-authentication/ https://docs.mongodb.com/v2.6/reference/configuration-options/#security.authorization Set up the first user: exec sudo vim /etc/mongod.conf add security: authorization: enabled restart sudo service mongod restart connect from localhost, start mongo shell mongo insert superadmin use admin db.createUser( { user: “superadmin”, pwd: “123456”, roles: [ { role: “userAdminAnyDatabase”, db: “admin” } ] } ) restart sudo Read more…

mysqldump – sichern und einspielen

Kommando zum Sichern aller Datenbanken mysqldump -u[user] -p[password] –all-databases > backup.sql Und speziell für Windows Maschinen mysqldump -u[user] -p[password] –all-databases -r backup.sql http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_result-file Sichern einer bestimmten Datenbank mysqldump -u[user] -p[password] [databasename] > backup.sql Kommando zum Einspielen der Sicherung: komplette Sicherung mysql -u[user] -p[password] < backup.sql Kommando zum Einspielen der Sicherung: Read more…

find duplicates in sqlite

My table has 3 columns: col1 col2 col3 I want to detect all columns with duplicates in col1 + col2. SELECT *, rowid, COUNT(*) c FROM “table” GROUP BY col1, col2 HAVING c > 1 This query will give me all row ids with equal values in col1 and col2.