Forward Engineer not creating tables from Model in MySQL Workbench - mysql

I am completely confused by the way Workbench works. Here are the steps I take, but I don't know where my mistake is.
I created a localhost connection.
Created a Model.
Created a database in the local connection.
Forward Engineered the Model into the local connection.
Tables from the Model are not in the database???
Can someone help me with this dark magic? I am a beginner and the process is very confusing.

I figured it out.
My mistake was that I forgot to give the model a name, and the forward engineering created it with a default one.
Also, I tried creating the database manually (with one name) which is redundant since the database was created already (with another).
The steps would be:
Create a localhost connection.
Create a Model AND name it.
Forward Engineer the Model into the local connection.

Related

Creating a database in Laravel

Forgive me if this is a silly question, just been scratching my head for hours on this and cannot find a decent answer!
I'm writing a script to install a Laravel CMS to a database and would like to have it create the database from the given name if it does not exist.
I am at the stage where the system understands that the database does not exist and so needs to create it, But every time I run my code I get the exception:
SQLSTATE[HY000] [1049] Unknown database 'mytesting' (SQL: CREATE DATABASE mytesting)
I'm running the code as follows to initiate the database creation:
DB::statement(DB::raw('CREATE DATABASE '.$_POST['DbDatabase']));
Now, I can understand that this may be crashing because the database name set in the .env is that of a database that is yet to exist, but I am wondering if there is a way to have the system simply auth to MySQL via login (No db name specified) and then create the table?
I've run the provided sql inside Sequel pro and it works there so I know it's valid, But am confused all the same!
If any yall could shine some light on this I'd be eternally grateful!
Thanks guys <3
I finally managed to figure out a way around this!
So instead of using Laravel's DB manager I ended up using a PDO instance instead as I could control what it did at a much more granular level. I specified the connection details out of the env file.
Thanks so much for your help guys <3

MySQL - Cannot create ERD in Server Instance Schemas

I am brand new to MySQL and I am trying to understand how it all fits together. I have a very strong understanding of Microsoft Access, but this is a whole new world.
I create a schema (MySQL Model) and I had no problem creating an ERD. I then figured out how to Reverse Engineer it and add it to the local instance of my server which is Local Instance MySQL56.
But I cannot find the ERD on the local server. I then added more tables on the server, but I want to add the tables to the ERD so that I can relate the tables. But I cannot find any option to add or edit an ERD.
Am I missing something? How do I relate the tables without an ERD?
Thanks,
David
#PM 77-1, thanks for your responses. I am using Workbench for MySQL, which is a GUI.
I did discover the answer to my question by experimenting more with the tool.
While viewing the MySQL Server Instance, select the database that you are working on.
Select the Database Menu and Reverse Engineer...
For me, I just accepted all of the default options as I stepped through the wizard.
Then once I finish making all of the changes, reverse the process by doing a Forward Engineer.

Visibility of databases in cloudbees?

I'm looking into using CloudBees for some application prototyping. I am using free accounts right now, I am not paying any subscriptions at the moment.
The first step for me is to create a MySQL database to host my application's data. I've done so (and it was pretty easy!). I also use Liquibase to manage the database (I've started this work using local H2 databases for the pre-prototyping), and I've been able to construct everything as expected.
As part of checking whether liquibase created the tables, I brought up the MySQL database in NetBeans. And, it did function well. But I can also see other schemas as well as the schema I just created. They're all innocently named (test, test_6hob). But, I can see the tables and view their data.
My question is around the visibility of the data that's in the CloudBees database. Is the database created for the free accounts viewable to other people connecting to the same machine? Does this change if I use a paid account? Or is it more the nature of how the database was created? I can see other schemas (and their data) but I have no idea if other people can see mine? Is there a permissions-aspect I need to ensure I set? I've fairly ignorant with the inner-workings of MySQL.
While this is a prototype, were I to move into using CloudBees for production applications, I wouldn't want the data to be visible to anyone who happened to connect to the same database as my application. It's entirely possible that I'm missing something in this new cloud world. :)
Thanks for any info
All CloudBees MySQL databases are secured separately (although will be in shared instances unless you have a dedicated server) - they are not readable by any other account by default.
However, it is possible for the database owner to grant access to users from other accounts on that same database server if you really wanted to - even though it makes very little sense to do so (and your special user configuration will be lost during a failover).
So this is what has happened for the test databases that you can see - the database owner has opened up security on those databases / tables.
This question is probably off topic but i'll bite anyway. The database data is private to your account. Actual hardware/vm's maybe shared but the data/database is not.

Entity Framework 4.1: Code first error: "the model backing the context has changed since the database was created"

Im creating a database via a "code first" application, the sql server contains no databases.
The application runs fine, creates the database and seeds the data i have defined in my initializer.
a service i have running tries to add some data to the database for the first time. i get the error:
The model backing the 'yyyContext' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the DropCreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.
There should be no changes since the database was created and when then service runs.
I'm running EF4.1, and the database doesn't exist so unlike questions with similar titles:
Database.SetInitializer<YourContext>(null);
Isn't the solution for me.
Any ideas about what could be wrong are welcome.
Doh! moment, turns out the service wasnt using the same connectionstring as the other app.
the reason the databases didnt look the same must be because earlier in development i started the main app with no connectionstring aswell, so it provisioned a local instance database for itself to use.
Then later when i was trying to use the service, it was trying to access the same database from earlier, and the model changed significantly since then.
I pointed the connectionstring to the correct database and everything worked from there.

Synchronize 2 database in django

I have 2 different server running django in it. (using postgre)
Both has the same user table.
I wanted to synchronize the user table, as if I update or delete user in one server then the 2 db should also get updated.
I guess replication is not a solution for my case.
Can anyone point me in right directions. or any link or reference will be helpful.
Both server are running different django code.
Thanks,
I don't know how to do this in PostgreSQL, but in MySQL you could create database VIEW pointing to a table in another database. This way you could reuse the existing auth_user table in the other sever.
I would take a look at pgpool-II. I haven't used it myself, but it's been recommended to me for similar purposes and after a bit of research I came to the conclusion that it's one of the better projects out there.