Oracle's MySQL is a popular open-source relational database management system that is based on Structured Query Language (SQL). It is frequently used in conjunction with PHP to enhance the capabilities of websites. PHP comes preloaded onto Mac computers, but MySQL does not.
Can any one please let me know how to create new user and new db in MySQL? How to use mysqladmin in Mac OS X?
Loïc Wolff5 Answers
If you are using the terminal client, generally you can do things like reset the root users password for mysql or create databases.A simple example can be found at the MySQL docs site, of which I will copy the highlights.
To create a new MySQL user:
Login to MySQL in Terminal:
mysql -u username
In the prompt:
CREATE USER 'admin'@'localhost';GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost';
- If you want to create a database:
create database name;
is all you need to do
If you do decide to use mysqladmin, mysqladmin can create and drop databases, but it cannot create new users.
Thanks everyone. I used the below commands to figure it out.
nohillside♦You have many choices, you can use MySQL Query browser , or PhpMyadmin.
Am1rr3zAAm1rr3zATry, introduce complete path to mysql:
Go to Terminal:
I hope help you!
You must log in to answer this question.
Not the answer you're looking for? Browse other questions tagged mysqladministrator .
I downloaded the mysql dmg file and went through the wizard to run. Done. I have also started mysql server under system preferences.
The purpose of me doing this is to work through the exercises of my SQL text book. The terminal commands are new to me but I think once I can actually get started, working through the exercises should be OK.
From researching the web the various blogs tell me to navigate to to the mysql folder in the terminal: /usr/local/mysql
Fine. Then it gets a little less clear as nearly each article has a different set of instructions on how to proceed. I was fiddling with it yesterday and was prompted for a password - what is the default mysql password?
Could someone give me the steps to get up and running with mysql via the terminal?
Doug FirDoug Fir8 Answers
(Updated for 2017)
When you installed MySQL it generated a password for the root user. You can connect using
and typing in the generated password.
Previously, the root
user in MySQL used to not have a password and could only connect from localhost. So you would connect using
open terminal and type
then close terminal and open a new terminal and type
hit enter, and it will ask you for password
I have found this solution on https://teamtreehouse.com/community/says-mysql-command-not-found
now to set new password type
In the terminal, I typed:
I was then prompted to enter the temporary password that was given to me upon completion of the installation.
Brad CannellBrad CannellIf you have your MySQL server up and running, then you just need a client to connect to it and start practicing. One is the mysql-client
, which is a command-line tool, or you can use phpMyAdmin
, which is a web-based tool.
This command works for me:
(PS: I'm working on mac through terminal)
Fozorotry with either of the 2 below commands
/usr/local/mysql/bin/mysql -uroot -- OR --
/usr/local/Cellar/mysql//bin/mysql -uroot