torarnehave1 / slowyouio

0 stars 0 forks source link

Here are step-by-step instructions for creating a new MySQL user with admin privileges in a Linux environment: #41

Open torarnehave1 opened 2 months ago

torarnehave1 commented 2 months ago

Here are step-by-step instructions for creating a new MySQL user with admin privileges in a Linux environment:

Creating a New MySQL Admin User in Linux

  1. Open a terminal and log into your MySQL server as the root user:

    mysql -u root -p

    Enter the MySQL root password when prompted.

  2. Once logged into the MySQL shell, create a new user with the following command:

    CREATE USER 'torarnehave'@'localhost' IDENTIFIED BY 'your_password';

    Replace 'your_password' with a strong password for the new user.

  3. Grant the new user administrative privileges by running the following command:

    GRANT ALL PRIVILEGES ON *.* TO 'torarnehave'@'localhost' WITH GRANT OPTION;

    This grants the torarnehave user full privileges on all databases (*.*) and allows them to grant privileges to other users (WITH GRANT OPTION).

  4. Flush the privileges to ensure the changes take effect immediately:

    FLUSH PRIVILEGES;
  5. Exit the MySQL shell:

    EXIT;
  6. Test the new user's access by logging into MySQL with the new credentials:

    mysql -u torarnehave -p

    Enter the password you set for the torarnehave user when prompted.

  7. Once logged in, you can verify the user's privileges by running:

    SHOW GRANTS FOR 'torarnehave'@'localhost';

    This will display the privileges granted to the torarnehave user.

You should see output similar to the following, confirming the admin privileges:

+---------------------------------------------------------------------+
| Grants for torarnehave@localhost                                    |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'torarnehave'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+

That's it! You have now created a new MySQL user named torarnehave with full administrative privileges. The user can log in from the localhost and manage all databases on the MySQL server[1][4].

Remember to use strong, unique passwords for your MySQL users to ensure the security of your databases[1][4].

Citations: [1] https://www.atlassian.com/data/admin/how-to-grant-all-privileges-on-a-database-in-mysql [2] https://www.liquidweb.com/kb/grant-permissions-to-a-mysql-user-on-linux-via-command-line/ [3] https://www.pluralsight.com/resources/blog/guides/highlight-react-in-github-markdown [4] https://phoenixnap.com/kb/how-to-create-new-mysql-user-account-grant-privileges [5] https://docs.digitalocean.com/products/databases/mysql/how-to/modify-user-privileges/ [6] https://dev.mysql.com/blog-archive/how-to-grant-privileges-to-users-in-mysql-80/ [7] https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0 [8] https://linuxsimply.com/create-user-account-in-ubuntu-using-terminal/ [9] https://www.techrepublic.com/article/create-mysql-8-database-user-remote-access-databases/ [10] https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax [11] https://stackoverflow.com/questions/6235995/markdown-github-syntax-highlighting-of-code-block-as-a-child-of-a-list [12] https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql [13] https://dev.mysql.com/doc/refman/8.3/en/default-privileges.html [14] https://www.liquidweb.com/kb/create-a-mysql-user-on-linux-via-command-line/ [15] https://www.hostinger.com/tutorials/mysql/how-create-mysql-user-and-grant-permissions-command-line [16] https://www.prisma.io/dataguide/mysql/authentication-and-authorization/user-management-and-authentication [17] https://tecadmin.net/how-to-create-an-admin-user-in-mysql/ [18] https://www.cyberciti.biz/faq/how-to-create-mysql-admin-user-superuser-account/ [19] https://www.strongdm.com/blog/mysql-create-user-manage-access-privileges-how-to [20] https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql