Come creare un nuovo utente mysql / db in Mac OS X?
-
22-10-2019 - |
Domanda
Può qualunque per favore fatemelo sapere come creare nuovo utente e nuovo db in MySQL? Come utilizzare mysqladmin in Mac OS X?
Soluzione
Se si utilizza il client terminal, in genere si possono fare cose come reimpostare la password di root per gli utenti MySQL o creare database. Un semplice esempio può essere trovato al MySQL docs sito , di cui vi copiare i punti salienti.
Per creare un nuovo utente MySQL:
-
Accesso a MySQL nel terminale:
mysql -u username
-
Nel prompt:
CREATE USER 'admin'@'localhost'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost';
- Se si desidera creare un database:
create database name;
è tutto quello che dovete fare
Se si decide di utilizzare mysqladmin, mysqladmin può creare ed eliminare i database, ma non possono creare nuovi utenti .
Altri suggerimenti
È possibile utilizzare un client GUI, come Sequel Pro .
Grazie a tutti. Ho usato il seguito comandi per capirlo.
Sarbbottam-Bandyopadhyays-MacBook-Pro:bin sarbbottam$ mysql -u root
mysql> create database tutorialdb;
mysql> create user 'tutorialuser'@'localhost' identified by 'tutorialuser';
mysql> grant all on tutorialdb.* to 'tutorialuser'@'localhost';
mysql> exit
Bye
Sarbbottam-Bandyopadhyays-MacBook-Pro:bin sarbbottam$ mysql -u tutorialuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1532
Server version: 5.5.9 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Avete molte scelte, è possibile utilizzare il browser MySQL Query o PhpMyadmin .
Prova, introdurre percorso completo mysql:
Vai al Terminal:
$ /usr/local/mysql/bin/mysql -u user
Spero aiuto voi!