![]() Please note, it is not a secure practice. Also, you will need to enable remote access to your database. If you want to create a remote user to access your database you can replace 127.0.0.1 with Remote IP. This creates a new read-only MySQL local user that can access your databases. GRANT SELECT, SHOW VIEW ON $database_name.* TO IDENTIFIED BY ‘ $password‘ REQUIRE SSL Creating a MySQL or MariaDB user and granting permissions to him to access a specific database and be able to write data on it is a very usual task that is necessary to perform each time you install a new application based on any of these database engines, like web applications running on top of LAMP stack. If you want to use SSL connection, you can use the following instead This will most likely be the root account, but if not, you can adjust the commands here. You’ll need to log in using an account that has the privilege to create new users. GRANT SELECT, SHOW VIEW ON $database_name.* TO IDENTIFIED BY ‘ $password‘ Conclusion Log in to MySQL The first step to creating a new MySQL user is to log in to the database. Grant read-only permission to the MySQL userĬopy the following command and paste them into a MySQL shell. In the lower window frame, Check the Select permission under the Grant column. Select the user in the Users or Roles list. If your user does not show up in the list, choose Search and type their name. Replace $database_name, $user, and $password below with the values you will be using.ĬREATE USER ‘ IDENTIFIED BY ‘ $password‘ 3. For the GUI minded people, you can: Right click the Database in Management Studio. Create a new MySQL userĬopy the following command and paste them into a MySQL shell. Run any database shell that works with MySQL. If up update the SQL statement to: mysql>GRANT CREATE ON test. At a Windows command prompt, run the MySQL command-line program, and log in as an administrator by typing the following command from the MySQL root folder (e.g Program Files\MySQL\MySQL Server 5.5\bin):Ĭ. I am not attempting to create a user, but rather grant a user access to a non-existent database (as is the approach with MySQL to grant a user privileges to create a database). At a UNIX prompt, run the MySQL command-line program, and log in as an administrator by typing the following commandī. Run the MySQL command-line program by doing one of the following:Ī. Here’s how you can create a read-only MySQL user. Sometimes you need to create a read-only MySQL user credentials for a new team mate to prevent accidental queries being fired into your database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |