Wordpress key Duplication Error - database

I just uploaded my database onto a remote server, however I am having a database connection error. As all configurations were fine, I contacted my host and they said the connection is fine however I have a lot of key duplication error. Is there any way I can fix this?

Wipe the database and re-import the sql file. Depending on the host, they may have had a wp_ database already uploaded so when you're uploading your database there are duplicate entries. Or, if your db failed to upload once and you tried it again, there could be some overlap there as well.
This is the answer

Related

SQL Server Database Primary Data File got lost

SQL Server 2008 R2 stopped all of a sudden due to (maybe) Power Fluctuation.
I tried all the possible ways to restart the it but every time it is failing with the error
The request failed or the service did not respond in a timely fashion.
Some of the ways I tried are
Making the SQL Server to log On as "Local System" instead of "NetworkService"
Replacing of Master.mdf and mastlog.ldf files from the "Bin/Templates" folder
Disabling "VIA" (which was already disabled)
But all in-vain :(
On checking further I noticed that both the data files i.e. mydb.mdf and mydb.ldf of my database are not there in the DATA folder and instead there are mydb_1.ndb and mybd_2.ldf files.
How to recover mydb.mdf file and to restart the SQL Server?
Thank you.
sql data files can be named anything so the mydb_1.ndb could be your data file.
If that's true you should be able to recover the data by:
Install a new sql server (sql express would work if the DB is < 10GB)
move the mydb_1.ndb and mybd_2.ldf onto that server
Use "Attach..." from ssms to add the database to the new server
If you are lucky and that ndb is just a differently named mdf file you should be able to access the data.
Then you can repair your existing server (reinstall will be easier than messing with the master database unless you've got other dbs on there) and move the database back over i.e. do the same attach... method
Oh - and start backing it up :)

ASP.NET MVC there's no mdf file anywhere... but my database still works?

My Website has two databases, one for user accounts and one for content. Both are created code first, and both have data in them.
But I have only one mdf file in the project. The site works locally, the content gets displayed, I can edit and add to it, and the changes are effective. I can add users, and their accounts work. But the only mdf file I have in the project is the user database.
I can connect to localdb in sql server managment studio and get only the user database. There's no database whose structure and tables would match the content database. I can go to server explorer in Visual Studio, and only the user database shows up under connections. I did of course refresh my solution explorer several times with "show all files" on. I even did a full disk search for all mdf files anywhere on my computer, and it didn't come up with one that would fit the bill.
I tried to fiddle with connection strings in web.config (of which there were none auto-generated) because I read that this could trigger the creation of the mdf file (although the context was always an empty database that didn't get created), but all that brought me was that the application now didn't find the database anymore either. reverting the changes in web.config did not resolve that issue, but reverting the whole project from svn did.
The database was migrated 10 times during development, always without error. Everything works fine, except I can't find the physical database anywhere. Which of course is a problem for deployment.
I had noticed that I had only one mdf file in the project during development, but I didn't think much about it at the time. after all, everything worked (and still does).
Are there other means than mdf by which ASP.NET MVC can store a database? That data I'm seeing on the screen has to come from somewhere... but for all I can tell, not from an mdf file.
EDIT: after reverting and rebuilding, there was now a default connection string generated in web.config. However, it simply points to the user database, i.e. the file I can find in the App-Data folder:
connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-RAOC-20150430022043.mdf;Initial Catalog=aspnet-RAOC-20150430022043;Integrated Security=True" providerName="System.Data.SqlClient"
-----some more info-----
I have experimented with connection strings some more. On adding the following connection string to web.config, the .mdf file finally got created:
<add name="RAOCentities" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\raoc.mdf;Initial Catalog=aspnet-raoc;Integrated Security=True" providerName="System.Data.SqlClient" />
However, as was kind of expected, it didn't contain the content, so I got a null reference exception. Removing the connection string from web.config restored the old functionality. So the real question it comes down to is: Where is that content stored? and how can I put it into an mdf?
-----still more info-------
After some experiments, the conclusion that the content data is indeed stored inside the user database seems inevitable. At least that seems to be the only file that changes if I change the content according to an svn dif. But I can't see the tables in sql server managment studio. I can only see the tables from the user database (your default applicationdbcontext), not from my own entities. Yet everything points to the fact that the data is in there somewhere. Anybody got any ideas how that is possible?
Well, I'm still in the dark on what went on and how those two databases could exist in the same file with SQL-server manager only seeing one of them but ASP.NET obviously being able to access both, but at least I solved the problem.
On the off-chance that anyone should ever find himself confronted with the same problem, here's what I did:
I duplicated the database model under another classname and set a connection string to it. Doing this resulted in the output of an empty database with the right tables as an mdf file, while not breaking the connection to the unfindable database with the actual data in it. Then I ran a short function that copied the contents of the filled database into the empty one, removed the duplicated class and set the connection string to connect the now populated mdf with the original database model. Result: a working database I could actually publish.

Error establishing a database connection - wordpress

I get this error. The connection details in the wp-config file are correct. I have only been getting this error ever since I sent the website files to my boss to put the website online. I also did a dump of the database to send to him.
Is it at all possible that something he did effected my local copy of the wordpress website? It doesn't seem so...but I have only had this issue since he put it online. Maybe did I remove my database by mistake when I did the dump? Can I check that somehow?
Does a database dump mess up my database? I was the one that did the database dump, to send to him. Did it move my database?
Can I reinstall wordpress as a solution and copy my website into it?
Cheers.
Check if your live server database credentials match with details in your wp-config.
your localohost credential might be different from server credential
Secondly check if your boss has restored dump database

Transferring DNNdatabase from local to production

I creaed one dnn applicaiton, and the source is moved to production and also same as the database is also moved to production server, but i am getting the dotnetnuke error. I think there is a database not inserted correctly.
Can you help me how to transfer the database from local to production..
I would double check that your local and production site web.config have the same machine key and decription key all match
Other thing to check would be that the connection string is correct
One more thing would be to check permissions on the database
Use SQL Delta

Why am I getting errors after renaming my database in CakePHP?

After I uploaded my application created using cakephp, I found out that I had to rename the database. I renamed my database accordingly and changed the settings in the database.php file in the "config" folder. But my application is still not running.
I am being shown this error message
"Missing Database table"
"Error: Database table tbl_topics for model Topic was not found."
I have double checked the existence of tbl_topics in the database (it is there in the database) but the application says "table not found"
what might be the problem, please help me out...
Make sure the host/user/pass that you've set-up in the config.php file have access to that database and table
You could also try running cake schema generate --dry which will spit back any problems with the connection that you might be having
Also have a look in your app/tmp/logs for some extra information on the problems you are experiencing
Take the username and password you are using for cakephp and it's db connection and connect to the database from the command line. I'm presuming you are using a unix-type system and mysql?
mysql --user=user_name --password=your_password db_name
...and then try to run a simple select:
SELECT * FROM tbl_topics
If you get an error there, it will at least identify that it is a low level db problem and the likely solution is that you need to grant permissions to that username to select from that database. Your current access levels for that user is probably granting access to the db under the old name.
You have probably uploaded your cache files as well. Make sure you delete all the files in /app/tmp/cache/*
Warning: Don't delete the folders, files only!
Also, make sure your tmp folder and all the subfolders are world-writable.
One last thought would be to check your model cache. I don't know why that would impact you with respect to connecting, but it's worth taking a look in app/tmp/cache.
:-)
finally got it.... :-D
I forgot to assign the user access to my application's database on main server. After assigning the permissions all went fine.
Anyways thank you all for your valuable answers... It helped me gain some additional knowledge about cakephp.

Resources