![]() ![]() This works fine when you're accessing this database with this new MySQL user account from the local computer system, but if you're going to access this database from another computer system, you'll need to specify the IP address of that remote system here instead of "localhost". It's important to note when I create this MySQL user, I'm giving the user access to this MySQL database from the computer system known as "localhost". (It seems a little unusual, but using grant is how you create a MySQL user account.) Note about this MySQL user account and “localhost” You can put that entire MySQL grant command on one line I just put it on multiple lines here so it would be easier to read. With MySQL 4 I used to do that in one step, as follows, but this approach doesn’t work with MySQL 5: I just did that in December, 2021, and it works fine. With MySQL 5 I create a new user and then grant user options on the database in two steps:ĬREATE USER IDENTIFIED BY 'my_password' Then create a new MySQL user account, giving the user account all the privileges it needs to “own” this database with the MySQL grant command. Mysql> create database my_database Step 3: Create the new MySQL user account Next, create a new database with the MySQL create database command, specifying the name of the database ( my_database) after that command: (here I enter 'my_root_password' to get through the mysql prompt) Step 1: Log into the databaseįirst, from your command-line prompt, log into my MySQL database server with the mysql command line client: to read-onlyusername identified by password If the collector will be installed on the same host as the database, type the. ![]() I have verified this approach with both MAMP and using MySQL on Linux servers. At the mysql prompt, do one of the following steps: To give the user access to the database from any host, type the following command: grant select on databasename. The following MySQL commands show an example of what I did recently to (a) create a new MySQL database and then (b) add a new MySQL user account to work with that database. This MySQL tutorial explains how to grant and revoke privileges in MySQL with syntax and examples. It asked for a password, just press enter. In the Wampserver menu select MySQL to open the prompt. There will be a warning about the skip-grant-tables option. ![]() MySQL “users” FAQ: How do I add a new user to a MySQL or MariaDB database (i.e., how do I create a MySQL user account, and then grant database permissions to that new user account)? Solution: MySQL add user and grant syntax In the Wampserver menu, select 'Restart Services. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |