Dino Geek, try to help you

How can I create a user in MariaDB and grant them privileges?


To create a new user and grant them privileges in MariaDB, you can follow the following steps. The following command should be entered into the MariaDB prompt.

1. Log into MariaDB as the root user. \`\`\` sudo mysql -u root -p \`\`\`

1. Create a new user. Replace ‘newuser’ with the new user’s name, and ‘password’ with the user’s password. \`\`\` CREATE USER ‘newuser’@‘localhost’ IDENTIFIED BY ‘password’; \`\`\`

1. Grant permissions to this user. The example below grants all permissions for the ‘database_name’ database. Replace ‘newuser’ and ‘database_name’ with your new user’s name and your database name respectively. \`\`\` GRANT ALL PRIVILEGES ON database\_name.\* TO ‘newuser’@‘localhost’; \`\`\`

1. If you want to grant specific privileges, use the following syntax: \`\`\` GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON database\_name.\* TO ‘newuser’@‘localhost’; \`\`\`

1. Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges. \`\`\` FLUSH PRIVILEGES; \`\`\`

1. Exit from MariaDB. \`\`\` exit; \`\`\`

Replace ‘localhost’ with ‘%’ to allow a user to connect from any host, not just the localhost. And don’t forget that your password must be secure to keep your database safe.
Always use a secure, unguessable password.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use