Most Popular

1500 questions
60
votes
3 answers

Is it possible to have passwords configured per database or per host in .my.cnf

I have the following in my ~/.my.cnf [client] password="somepass" but this is not the password I use for every user@host/database I connect to. Is there some way to specify in the config different passwords for different things so I don't have to…
xenoterracide
  • 2,921
  • 5
  • 31
  • 33
60
votes
11 answers

Why aren't primary key / foreign key matches used for joins?

As far as I could find out many DBMSs (e.g. mysql, postgres, mssql) use fk and pk combinations only to constrain changes to data, but they are rarely natively used to automatically select columns to join (like natural join does with names). Why is…
Tiddo
  • 1,017
  • 3
  • 9
  • 11
60
votes
3 answers

Why is a .bacpac file so small compared to a .bak file of the same database?

I've been doing backups of my SQL Server 2014 Express databases for import to other servers and noticed a difference in file size between .bacpac and .bak. Why is a .bacpac file so small compared to a .bak file of the same database? Thanks for any…
Chris
  • 703
  • 1
  • 5
  • 5
60
votes
6 answers

What problems will I get creating a database per customer?

I remember from the stackoverflow podcasts that Fog Creek use a database per customer for Fogbugz. I assume that means the Fogbugz On Demand servers have 10s of thousands of databases. We are just starting to develop a web app and have a similar…
Rik Heywood
  • 703
  • 1
  • 6
  • 6
59
votes
5 answers

I can't connect to my servers SQL database via an IP Address

I have setup a server that runs Windows Server 2008, and has SQL Server 2008 Express installed. I can connect to the machine's SQL Server Express database via the MACHINENAME/SQLEXPRESS. However when we come to connecting through any software or…
Shaun
  • 693
  • 1
  • 6
  • 6
59
votes
7 answers

In what data type should I store an email address in database?

I understand that an 254 character email address is valid, but implementations I have researched tend to use a varchar(60) to varchar(80) or equivalent. For example: this SQL Server recommendation uses varchar(80) or this Oracle example Is there a…
Thronk
  • 1,388
  • 3
  • 19
  • 39
59
votes
3 answers

Possible INDEX on a VARCHAR field in MySql

I am working in a MySql database, with a table like this: +--------------+ | table_name | +--------------+ | myField | +--------------+ ...and I need to make a lot of queries like this (with 5-10 strings in the list): SELECT myField FROM…
Mark Tower
  • 693
  • 1
  • 6
  • 6
59
votes
3 answers

How to get the timestamp column in only milliseconds from PostgreSQL?

I have a column "created" with type timestamp without time zone default now() in a PostgreSQL database. If I select colums, it has a nice and readable format per default: SELECT created FROM mytable; …
Jonas
  • 33,945
  • 27
  • 62
  • 64
59
votes
4 answers

Does updating a row with the same value actually update the row?

I have a performance-related question. Let's say I have a user with first name Michael. Take the following query: UPDATE users SET first_name = 'Michael' WHERE users.id = 123 Will the query actually execute the update, even though it is being…
59
votes
1 answer

Best practices for schema changes and data migrations to a live database without downtime?

How do you make schema changes to a live database without downtime? For instance, lets say I have a PostgreSQL database with a table including various user data like email addresses etc, all associated with specific users. If I wanted to move the…
Dan Leary
  • 693
  • 1
  • 6
  • 5
59
votes
4 answers

How to check foreign keys related to a table

How to see foreign keys related to a table in MySql? Background : I wanted to drop a table in MySql which has a foreign key constraint. When I do it I get this: Error Code: 1217. Cannot delete or update a parent row: a foreign key constraint…
Mr.X
  • 911
  • 1
  • 13
  • 19
58
votes
2 answers

pgAdmin: What is the Maintenance DB?

pgAdmin's Register - Server dialog for adding new database connections asks for a "Maintenance database". In order to be able to connect, I set it to the database I want to connect (and also, I have the rights to connect). So, why is that field…
jgomo3
  • 714
  • 1
  • 5
  • 10
58
votes
9 answers

Should you design the database before the application code is written?

What is the easiest and most efficient way to design a database? From my perspective, there are a couple of options for an application's data store design: Design the database as best as you can initially before writing any application code. This…
Thomas Stringer
  • 42,434
  • 9
  • 120
  • 155
58
votes
5 answers

What is a Key/Value store database?

I've been looking at the wikipedia page for NoSQL and it lists several variations on the Key/Value store database, but I can't find any details on what it means by Key/Value store in this context. Could someone explain or link an explanation to me?…
indyK1ng
  • 1,111
  • 2
  • 12
  • 11
58
votes
6 answers

After moving database (backup, restore), I have to re-add user

I occasionally move a database (SQL Express 2012) from a development machine to a server, or vice versa, using database backup and restore in SQL Server Management Studio. Whenever I do this, the applications on the target machine cannot access the…
xpda
  • 765
  • 1
  • 6
  • 8