-3

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.

Gowtham Raj J
  • 937
  • 9
  • 26
  • _now i want to edit the tables_ Double click the table and add values to it? and click on "Apply" button?? – Pradeep Simha Dec 25 '13 at 17:36
  • i want to edit the database which i created in CLI, but the databases i created in CLI does not show up in myql workbench. – Gowtham Raj J Dec 25 '13 at 17:41
  • Most likely you didn't do `Database->Forward engineering` in MySQL Workbench if you want to create a database from your model. Or `Reverse Engineering` if you want your database that you created in any mysql client to show up in your model in Workbench. – peterm Dec 25 '13 at 17:41

1 Answers1

1

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

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
  • Thank u. This is what i asked. I have been using MySQL 5.0, and i use MySQLQueryBrowser(in MySQL Tools) to view tables and edit its content. Since workbench's UI is different than MySQLQueryBrowser's UI, I didn't knew how to use it. **Thanks a lot for your help**. – Gowtham Raj J Dec 28 '13 at 08:13
  • @gowthamrajj: please accept my answer then if it solved your problem. You can also upvote it if you feel it deserves it. – Mike Lischke Dec 28 '13 at 14:49