torarnehave1 / slowyouio

0 stars 0 forks source link

Here are step-by-step instructions for creating a new MySQL user with admin privileges and granting access to a specific database in a Linux environment: #42

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 and granting access to a specific database 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 'maiken'@'localhost' IDENTIFIED BY 'your_password';

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

  3. Grant the new user administrative privileges on the specific database maikenslowyouio by running the following command:

    GRANT ALL PRIVILEGES ON maikenslowyouio.* TO 'maiken'@'localhost';

    This grants the maiken user full privileges on the maikenslowyouio database and all its tables.

  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 maiken -p

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

  7. Once logged in, switch to the maikenslowyouio database:

    USE maikenslowyouio;
  8. Verify that the user has access to the database by running a simple command, such as:

    SHOW TABLES;

    This will display the list of tables in the maikenslowyouio database.

You should now have a new MySQL user named miken with full administrative privileges on the maikenslowyouio database. The user can log in from the localhost and manage the specified database[1][4][6].

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

It's important to grant privileges specific to the user's requirements and avoid granting unnecessary privileges to minimize security risks[4][6]. Regularly review and update user privileges as needed.

By following these steps, you can create a new MySQL admin user with access to a specific database in a Linux environment, allowing for secure and controlled management of your MySQL databases[1][3][4][6].

Citations: [1] https://www.hostinger.com/tutorials/mysql/how-create-mysql-user-and-grant-permissions-command-line [2] https://dba.stackexchange.com/questions/151677/create-a-user-with-privileges-to-create-users [3] https://www.cyberciti.biz/faq/how-to-create-mysql-admin-user-superuser-account/ [4] https://stackoverflow.com/questions/1720244/create-new-user-in-mysql-and-give-it-full-access-to-one-database [5] https://www.atlassian.com/data/admin/how-to-grant-all-privileges-on-a-database-in-mysql [6] https://docs.digitalocean.com/products/databases/mysql/how-to/modify-user-privileges/ [7] https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql [8] https://contabo.com/blog/how-to-create-a-user-and-grant-permissions-in-mysql/ [9] https://www.liquidweb.com/kb/create-a-mysql-user-on-linux-via-command-line/ [10] https://phoenixnap.com/kb/how-to-create-new-mysql-user-account-grant-privileges [11] https://tecadmin.net/how-to-create-an-admin-user-in-mysql/ [12] https://www.strongdm.com/blog/mysql-create-user-manage-access-privileges-how-to [13] https://blog.devart.com/how-to-create-a-new-user-and-grant-privileges.html [14] https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql [15] https://stackoverflow.com/questions/5016505/mysql-grant-all-privileges-on-database [16] https://dev.mysql.com/doc/refman/8.3/en/privileges-provided.html [17] https://dev.mysql.com/doc/refman/8.3/en/creating-accounts.html [18] https://stackoverflow.com/questions/5131931/how-to-connect-to-mysql-from-the-command-line [19] https://dev.mysql.com/doc/refman/8.0/en/grant.html [20] https://blog.devart.com/how-to-connect-to-mysql-server.html