how to insert/edit data into database(s) which i created in CLI using mysql workbench? [closed]

StackOverflow https://stackoverflow.com/questions/20775275

Domanda

how to insert/edit data into database(s) which i created in CLI using mysql workbench?

I created a mysql database in CLI, and now i want to edit the tables and its content using mysql workbench, please help.

And also if i created a database directly in mysql workbench, i am unable to connect to that database from my Java program using odbc and i get the error "unknown database 'mydatabase'". Thats why i need to edit the tables created in CLI using mysql workbench, since its more convenient.

È stato utile?

Soluzione

Watch out: reverse engineering belongs to modeling and has absolutely nothing to do with data management in a real db object like a table. Modeling, reverse engineering, forward engineering, synchronization etc. in MySQL Workbench all belong to structure and design work. It's about design of meta data.

For editing/adding/removing data in a db table use the SQL IDE in MySQL Workbench. Open a connection to your server and you should see the schemas and their objects in the tree on the left hand side. Expand it to your table and right click on it. In the context menu choose the SELECT command. You can also simply write a SELECT * from yourtable in the SQL editor. If your table has a primary key it can then be edited in the result grid that comes up. Don't use aggregates, UNIONs, joins etc or the result will be read-only.

A frequent stumbling stone for newbies is also the privilege system of MySQL. Creating a schema or table does not mean that every user can access it. You have to give a user the proper rights to browse schemas and to act on a specific schema (or, if you want it more fine grained, down to a single table). You have to do this only once - after you created your schema. Use MySQL Workbench's admin module for this task. It helps you to manage your users and their privileges:

enter image description here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top