![]() ![]() In this situation, it was nice that mysqluserclone checked to make sure that the user did not exist before attempting to clone that user. I then realized that I had put in the wrong IP address of my new server. Use -force to drop and recreate user.Īt first, it appeared that somehow during the creation of the new replication slave, I had already created the user named WebUser, or that user already existed. I issued the following command, and this is what happened: I needed to clone the user named “WebUser” from my master server (192.168.1.2) to my new replication slave server (192.168.1.5). ![]() I have created a user named “utility” on all of my servers, which I use instead of the root user for creating users and executing scripts. You need to make sure that the MySQL user on each machine that you are using to perform the user creation has the proper MySQL permissions on that machine. In my case, I wanted to clone a user to a remote machine. The new users can be created on the original server or a different server.”Īs the man page states, you may clone an existing user on the local machine, or on any remote machine. With mysqluserclone, the process is much easier and faster.įrom the mysqluserclone man page: “This utility uses an existing MySQL user account on one server as a template, and clones it to create one or more new user accounts with the same privileges as the original user. This doesn’t take that much time, but what if you wanted to create the same user on several remote machines? You would have to connect to each machine, login to mysql, and then issue the commands. | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE TABLESPACE ON *.* TO | ![]() Mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE TABLESPACE ON *.* TO OK, 0 rows affected (0.00 sec) Mysql> CREATE USER IDENTIFIED BY PASSWORD '*xxxxxxxxxx' I would then go to the new instance, copy the above SQL statement, and issue the CREATE USER command using the HASH value of the password, and then issue the same “GRANT SELECT,…” statement – but without the IDENTIFIED BY PASSWORD part of the command. | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE TABLESPACE ON *.* TO IDENTIFIED BY PASSWORD '*xxxxxxxxxx' | Normally, to duplicate a user, I start by taking a look at the privileges that this user has by issuing a “ SHOW GRANTS” statement, like this: The user that I wanted to copy from the master to the slave was named “WebUser”. With the mysqluserclone script, it was fairly easy. I recently created a new MySQL replication slave instance on a new server, and I needed a way to copy a few of the users from the master database over to the slave database. You will also need to install Python and to make sure that your execution $PATH’s are set correctly. If you don’t have Workbench, you may download the MySQL Utility scripts from. They are designed to work with Python 2.x greater than 2.6. The utilities are written in Python, available under the GPLv2 license, and are extendable using the supplied library. MySQL Utilities are a part MySQL Workbench. This post is one in a series that I will be doing on MySQL Workbench Utilities – Administer MySQL with Python Scripts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |