57

Open terminal and edit /etc/mysql/my.cnf sudo nano /etc/mysql/my.cnf Underneath the [mysqld] section.add: lower_case_table_names = 1 Restart mysql sudo /etc/init.d/mysql restart Then check it here: mysqladmin -u root -p variables


39

In a politically correct sense, what you just asked for is impossible. Why ? The SUPER privilege is a global privilege, not a database level privilege. When you created the user with grant all privileges on db1.* to user1@'%' with grant option; you populated the table mysql.user with user=user1 and host='%'. All other columns (global privileges) were ...


26

I had the exact same problem. What I did was: GRANT SUPER ON *.* TO user1@localhost And problem solved. CAVEAT: Is there any danger in granting SUPER privileges to a user?


23

You can use the INFORMATION_SCHEMA database and the COLUMNS table in particular Example of use: SELECT table_name, column_name, data_type, ordinal_position FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = 'myDatabase' --- the database you want to search AND column_name = 'name' ; --- or: column_name LIKE '%name%'


17

SET @given_id = 1; SELECT name FROM table1 WHERE id = @given_id ;


17

Click on Edit -> Preferences -> SQL Editor and then check the box "Show Metadata and Internal Schemas" Click on Refresh icon on the right side of Schemas in the left side bar. I am using 6.3CE. Older versions may have something similar.


11

If you change lower_case_table_names in a DB with existing tables MySQL > Table doesn't exist. But it does (or it should) can happen. The comment to this answer helped me in this case: I reverted the value, restarted the database, exported the tables, set the value back to 1, restarted the database, re-imported the tables and everything worked again.


10

Assuming that your dataset is larger than your buffer pool, having it at 95% usage is not only normal, but a desired state. You want as much information as possible on memory- hardware and resources are there to be used- so that both next reads and writes can be done faster than having to access disk. A different thing is if that memory usage is being used ...


9

After you create a connection to your database, execute the following two commands: USE <DATABASE NAME>; SELECT * FROM <TABLE NAME>; Then MySQL Workbench will show another pane with the results. This will be the entire contents of the table.


9

To expand on @ypercube's answer (He gets a +1), if you do not know which database the table resides, do this: SELECT table_schema, table_name, column_name, data_type, ordinal_position FROM INFORMATION_SCHEMA.COLUMNS WHERE column_name = 'name' ; --- or: column_name LIKE '%name%'


9

I am getting the same error and I installed using MSI. Downloaded the VC redist packages for x64 and it fixed the issue: Visual C++ Redistributable Packages for Visual Studio 2013 Strange that the error message has python.exe as it's title.


9

It looks like you ran the container without setting the -p 3306:3306 parameter. Also, it seems that you mistyped the IP address in of the Hostname in MySQL Workbench. I recommend starting from scratch by following these instructions: Run the mysql server. (Change the password admin to anything you want) docker run -e MYSQL_ROOT_PASSWORD=admin --name mysql -...


8

From the MySQL Workbench 5.2 window, select Database -> Synchronize model which will allow you to synchronize the model (EER diagram) with the database (you need to create a saved connection) for it. I recommend this method over just reverse engineering the model from the database since it maintains the layout of the EER diagram. One caveat is that you ...


8

See File -> Export -> Forward Engineer SQL Create Script...


8

Try temporary disabling foreign keys (make sure no ones allowed to update the db meanwhile): create table t1 (id int not null primary key) engine = innodb; create table t2 (id int not null primary key ,t1_id int not null , constraint abc foreign key (t1_id) references t1 (id) ) engine =...


7

Thanks Mika, I tried your solution in workbench (5.2.41). It worked after I cleared the passwords in the vault (click Manage Connections) and restarted the WorkBench. To clear passwords stored in the vault, I did the following: Open MySQL WorkBench the you will see the home page Click Manage Connection at bottom left corner. In Manage DB Connections, click ...


7

MySQL Workbench does not have the capability to "infer" the relationships from table column names, or MyISAM tables. It requires that the constraints be defined in the database or SQL script being reverse engineered.


7

The error indicates that you have invalid references in the parentId column. This error shows when you are trying to insert a row with an invalid reference, update an existing row with an invalid reference, or delete a row that is referenced. You also get it when you are trying to create a foreign key constraint on a column that is already populated and ...


7

As of 5.5.3, FLUSH LOGS will close and reopen the slowlog. (In old versions, FLUSH had no effect on the slowlog.) So, on *nix OS, this should work without restarting the server: rm (to delete) or mv the slowlog to another name. (Note: mysqld will continue to write to the file, even though you changed the name.) FLUSH LOGS;. As of 5.5.3, you can limit ...


6

If you just want to see the data in a table then do a select for that table in a query editor. That's the most basic operation wrt SQL. Using the table search with some "mysterious query" certainly does not help to accomplish that task. Search is, as the name implies, a search. Put the value you are looking for in the search field and let MySQL Workbench do ...


6

You can take a backup from the live MySQL with Xtrabackup. Percona provides deb repository for Ubuntu. To install the repo for Ubuntu 12.04 follow instructions: Install the key: # apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A Add the source file: # cat /etc/apt/sources.list.d/percona.list deb http://repo.percona.com/apt precise ...


6

From the 5.7.6 release notes: If you upgrade to this release of MySQL from an earlier version, you must run mysql_upgrade (and restart the server) to incorporate the changes to the mysql database. mysql_upgrade moves Password column values to the authentication_string column and removes the Password column. For nonupgraded installations that have ...


6

If your column date_ordered is of type DATE, MySQL will store it in its own way. To display it in the format you want, you should use the function date_format(): https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format e.g. For DD-MM-YYYY format, you want to use the format string '%d-%m-%Y' select date_format (...


6

You can use a NOT EXISTS predicate. Assume you want to mimic: select a.c1, a.c2 from a except select b.c1, b.c2 from b This can be expressed as: select distinct a.c1, a.c2 from a where not exists ( select 1 from b where b.c1 = a.c1 and b.c2 = a.c2 ) Other options are to use a left join and check for null: select distinct a.c1, a.c2 from ...


6

Functional dependencies and normalization In order to carry out a normalization exercise involving second and further normal forms —as per the relational model of data by Dr. E. F Codd—, one first has to know what are the relevant functional dependencies (FDs for brevity) between the attributes (usually depicted as columns) of an adapted mathematical ...


5

MySQL doesn't support true booleans as per standard SQL. It uses integer values 1 and 0 respectively for true and false. It does support the keywords true and false, but these are mapped to the integer values. mysql> SELECT true, false; +------+-------+ | TRUE | FALSE | +------+-------+ | 1 | 0 | +------+-------+ They really are mapped to ...


5

The icon shows that that side of the relationship is not mandatory, meaning the field can be NULL. You can change that if you click on the relationship line, go to Foreign Key tab and select the Mandatory check box.


5

I recommend to do this migration in two steps. Use MySQL Workbench to migrate most of the db objects and data to MySQL (table data will be copied by this process too). See Using the MySQL Workbench Migration Wizard for details. This will leave you with manual work for specific objects like stored procedures. No tool can do an automatic migration as stored ...


5

The maintenance feature is a bit hidden in MySQL Workbench. You can reach it by opening your connection as usual and right clicking on your schema to open the schema inspector: You will get a new tab in the editor area with many pages for inspection/maintenance. Click on the Maintenance button at the bottom to open this page: From there it should be clear ...


5

This problem was causing pain for me, where Doctrine generated capital/CamelCase table names and MySQL stored them as lowercase! It was solved by changing my.cnf and adding lower_case_table_names = 1 under the [mysqld] section my.cnf can be found: under LAMPP/XAMPP... : /opt/lampp/etc/my.cnf stand alone mysql server : /etc/mysql/my.cnf Afterwards ...


Only top voted, non community-wiki answers of a minimum length are eligible