I was given a code repo which requires
mysql in command line.
I am using Mac OS 10.11
SQL Server 2017 Express is a free edition of SQL Server, ideal for development and production for desktop, web, and small server applications. Download now Install SQL Server 2017 on Windows, Linux, and Docker containers. Navicat for MySQL Client from PremiumSoft, is an integrated GUI tool let you perform MySQL administration and database development in an easier way. Advanced features allow you to create data models, import/export data, backup, transfer databases, create queries, and manage your local or remote MySQL server. In this post we will learn how to How To Install MySQL on Mac OS X. The same procedure can be used for installing MySQL on Mac OS X. How to Install and Configure MySQL Server on macOS Mac OS X. Get MySQL Download For Mac & Windows 32 / 64 Bit. They have many options of relational database management systems e.g. SQL Server, Oracle, MySQL or Teradata etc. MySQL is the most popular open source database management system. It allows you to quickly download and install and run a powerful database system on almost any platform available including Linux, Windows, and Mac OS X etc.
First, I installed
MySQL Community Server from http://dev.mysql.com/downloads/mysql/ and install it by running the
After that, I opened System Preferences to start MySQL Server.
Then, I tried to execute
and there is an error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
How could I have
mysql in command line?
/tmnt-out-of-the-shadows-download/. Typically the command is:
which will prompt you for your root password (which might be blank unless you changed it)
You can also use:
but keep in mind that password will be visible onscreen as you are typing it unlike the straight
-p option that will hide your password as you type it when prompted.
Take a look at the options for mysql: https://dev.mysql.com/doc/refman/5.6/en/mysql-command-options.html
In your case, I'd try
/usr/local/mysql/bin/mysql -u root -p then hit enter. mysql will prompt you for your password - type in in and hit enter again. If it's wrong mysql will let you know and then you'll have to go about resetting the mysql root password.
https://coolestguidesontheplanet.com/how-to-change-the-mysql-root-password/ is a reasonable set of instructions for doing that in OS X (may be out of date for your version of MySQL but the comments will help) but YMMV depending on where mysql was installed, etc..
Basically those instructions are:
sudo /usr/local/mysql/support-files/mysql.server stop
sudo mysqld_safe --skip-grant-tables
mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED by 'password';
sudo /usr/local/mysql/support-files/mysql.server start
Download Mysql Server For Mac 10
- Stops mysql
- Sets mysql to run without bothering with privileges
- Opens a mysql prompt
- Updates the root password to 'password' - you should use something else here.
- 'Cleans' passwords (some might say this is unnecessary)
- Exits the mysql prompt
- Starts mysql
That should allow you to run
mysql -u root -p and use the new password set in #4.