I have set up Django multiple-database configs. I have one default database for writing and two slave databases for reading. I'm using mySql.
Using Django shell, I write to the database and using the sql shell I can make sure the write operation was successful on the default and the slaves.
However, when I try to query the database from the shell I can't find the latest added value. Am I missing something ?
Related
When I try to log into MySQL via command line, keeps saying "unknown database 'magento2'"
Any ideas why? Tried as my username and root, getting the same message. If I can't log into mysql, how could I create a database to begin with of that name? So confused.
You should separate between your database application and a logical database. MySQL server is your database application / server.
When you're logging on to MySQL, you're choosing which logical database you would like to work with. A logical database is actually a container of objects such as tables, triggers, views, etc.
So when you see the error unknown database X, it's because you installed the MySQL server, but didn't create the logical database.
To see a list of all logical databases in your server, login to MySQL and run the command show databases;
To create your database, run the command create database magento2;
Now when you login to that database, it should be there and you can start creating your tables and query data from them.
I had the same issue and found that the database name was set in a cnf file. Perhaps you have something similar.
Pretty sure the answer is "no" but I have found no conclusive result...
Basically, can use MySQL to connect to a standalone database file and then use standard MySQL commands on it? Currently I use SQLite3 to do exactly this but I now like the usage of MySQL commands whilst retaining the single file devoid of a MySQL server. Is it possible?
Ilmiont
Not possible with mysql function, but still possible with PDO. Most SQL Commands should work in any SQL Based RDBMS.
PDO is meant to have a generic interface, so even if you would have a MySQL Database, you should consider developing in PDO.
Here is a Example for SQLLite3:
http://www.if-not-true-then-false.com/2012/php-pdo-sqlite3-example/
If you want to get deeper into PDO, read this article:
http://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059
Is it possible to change the default collation of SQL Server 2008 without having to reinstall the whole package ? It has to be Case Sensisitve by default - the application server I have checks this as a pre condition to installing and creating a database.
Yes it is, but it is not for the faint of heart...
From http://msdn.microsoft.com/en-us/library/ms179254.aspx:
Changing the default collation for an instance of SQL Server can be a
complex operation and involves the following steps: Make sure you
have all the information or scripts needed to re-create your user
databases and all the objects in them.
Export all your data using a tool such as the bcp Utility. For more
information, see Importing and Exporting Bulk Data.
Drop all the user databases.
Rebuild the master database specifying the new collation in the
SQLCOLLATION property of the setup command. For example:
Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName
/SQLSYSADMINACCOUNTS=accounts /[ SAPWD= StrongPassword ]
/SQLCOLLATION=CollationName
For more information, see Rebuilding System Databases.
Create all the databases and all the objects in them.
Import all your data.
If you can get away with just changing the default collation of the database(s) specific for the application, you may want to do that...
My ISP does not give me access to mysql shell and therefore I'm forced in to a manual import of the initial tables structures.
I can only use : phpMyAdmin and FTP to the SQL Server
Any idea how I could automate this with a PHP script? Apart from the last resort which consists of writing all creation steps one by one in PHP.
Perhaps something like a sql dump interpreter issuing the sql commands does exist ?
Basically you have to create your own interpreter.... quite simple simple actually.
Caveat: I have zero experience with MySQL.
I've been given a series of files to do a data conversion and would like to migrate the provided data into SQL Server 2008. The files are:
*.myd
*.myi
*.frm
These file types, as I understand it, are MyISAM. I believe that if I had a running MySQL instance, migrating to SQL Server would be fairly straightforward. I could could either use SQL Server's import wizard or Microsoft SQL Server Migration Assistant for MySQL v1.0. Unfortunately, these files are what I'm stuck with -- I just don't have access to the original MySQL instance.
I also don't presently have MySQL as a running instance locally and I'm not sure if there would be compatibility issues with the files I have.
Can I attach them to MySQL 5.5 with the goal of performing a SQLDump or perhaps to use either tool mentioned above? Am I missing a better way?
Yes, you can easily attach them to MySQL 5.5. Then you can dump the tables using mysqldump (be aware that you will need to either modify dump and remove mysql-specific stuff from the dump, or probably customize mysqldump output - check mysqldump documentation for details). You can also try to link Mysql instance to SQL Server, and then copy tables using SELECT ... INTO [sql_server_table_name] FROM [mysql_table_name].
In any case, the hardest part is to migrate stored procedures/triggers. Mysql and SQL Server have quite a different syntax for them, so you probably cannot automate this process.
Update
Also, I forgot to mention that you will have to modify mysql auto_increment columns to IDENTITY([next_auto_increment_value],1) SQL server.