Posted on Leave a comment

LED – Innards

The LED ( Light Emitting Diode ) is found in just about every corner of our world that you can imagine.

The first consideration is that the LED is a Diode. Just like every other Diode current only flows in a single direction. When current flows in the correct direction the Diode emits Light.

The LED is comprised of a small chip inside of a clear or colored epoxy. It has two leads that allow connection to the Anode and the Cathode of the LED.

Posted on Leave a comment

Momentary Push-button Innards

Small momentary push buttons can be difficult to understand, however if we look inside we can easily gain an understanding of their operation.

AS you can clearly see the black button portion pushes down on the thin disk. The center of the disk deforms and makes contact between the two contact strips. The disk also provides the spring return action and makes the clicking noise.

Posted on Leave a comment

MySQL Workbench – User Migration

Working on manual backup of my WordPress site I developed a very simple approach to migrate the WordPress database user along with their password. This can be used on any or multiple users of the database.

Requirements

  • A MySQL server with the user you want to copy to the backup
  • A working installation of MySQL Workbench
  • Server Connection to Source ( web-server for the source )
  • MySQL Server connection to target ( localhost in my case )

Getting the user with CREATE Statement

From the source database open a new query and enter the following SQL: Replace mcp_user with the user you would like to migrate.

show create user 'mcp_user'@'localhost';

First, using the MySQL Workbench connect to the source that has your user.

It should look something like this:

Run the query and then you can copy the results by right clicking on the Result Grid row and selecting “Copy Row (Unquoted)”. Connect to your local MySQL instance and paste the result into a new query.

Retrieve the Permissions

we will use the same command but for grants, again replacing “mcp_user” with your user.

show grants for 'mcp_user'@'localhost';

Perform the same copy action from above but this time select both rows before right clicking.

Copy User to Local Database

When you are finished you should have in your local host the following query, add a USE database; statement at the top, where database is the name of your schema.

USE mcp_wordpress;
CREATE USER 'mcp_user'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*A4852D8F9BDEFAXXXDD35EED97BEXXXYYY4E5BA' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
GRANT USAGE ON *.* TO 'mcp_user'@'localhost';
GRANT ALL PRIVILEGES ON mcp_wordpress.* TO 'mcp_user'@'localhost';
GRANT ALL PRIVILEGES ON mcp_wordpress.* TO 'mcp_user'@'localhost';

Test the User

Run this SQL and the attempt to login and do a show database to confirm.

mysql -u mcp_user -p

The password will be the same as the originating database

show databases;

Only the one database should be listed in my case.

That’s it, seems like a lot but it only 7 or 8 lines of SQL. If you know how to execute the results of the SHOW GRANTS or the SHOW CREATE, statements or an easier method, leave a comment I would love to learn that without a lot of digging around.