I have downloaded macOS 10.13 (x86, 64-bit), DMG Archive and install it on my Mac(10.13.6) but while accessing it in terminal it's not taking root password which I have set during the installation process.
I have checked system preference MySQL is running and trying to access MySQL by below command, though it's asking for the password but not taking it after trying it, its giving below error
sudo /user/local/mysql -u root -p
error : sudo: /user/local/mysql: command not found
You didn't install mysql there. Double-check where it's actually installed. You'll probably be able to use plain old mysql as the command name.
Related
I installed MySQL with brew using the command brew install mysql and it installed MySQL correctly, but it gave me instructions that say:
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
So I ran the command mysql_secure_installation, and it asked me for a password for the user root, and when I entered the password, it gave me this error:
The user provided does not have enough permissions to continue.
mysql_secure_installation is exiting.
I tried running mysql -u root -p and entering in the sql terminal, but I am not able to run any query because I don't have access to do anything. Also, not able to grant any access to the root user.
I also tried to uninstall MySQL from my laptop and install it again, but again the same problem occurs.
Does anyone have a solution for this?
I have MySQL stable 8.0.19 (bottled) installed via mac HomeBrew:
brew install mysql
and it asks me to follow these instructions in the Caveat section:
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
and when I run the mysql_secure_installation command with or without sudo I get:
Securing the MySQL server deployment.
Enter password for user root:
Now I tried looking for the default password. The MySQL installation process for macOS here shows that on the last step a temporary password is provided for the user:
[][5]
(source: [mysql.com](https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/images/mac-installer-root-password.png))
However, I do not see any information about a temporary password within the HomeBrew terminal outputs. From here I tried:
sudo grep 'temporary password' /var/log/mysqld.log
but I get:
grep: /var/log/mysqld.log: No such file or directory
then I tried looking for that log file:
sudo find / -name mysqld.log
but I get lots of find: ... Operation not permitted instead of any meaningfull results.
I would appreciate if you could help me know
if I have done everything correctly so far,
if not what mistakes I have made and how to fix them
if yes how I can acquire the temporary password
what are the next steps
Ideally, I should be able to follow the rest of this tutorial within the GUI.
Ok, I think I had some progress. I ran
brew services list
and it showed that mysql stopped, now I ran:
brew services start mysql
now the mysql_secure_installation script ran smoothly with
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
helping me set up a password and other settings. Now you may install the MySQL Workbench (the GUI seen in the tutorial) by:
brew cask install mysqlworkbench
and you should be able to find and run MYSQLWorkbench from your /Applications/ folder!
P.S. Wrote simple instructions here.
For macOS users, there is DBngin (https://dbngin.com) that gives
you push-button start/stop for MySql, PostgreSQL (and redis) .. different
versions with non-overlapping config/data directories.
Really saves me - and my students! - in my DB course.
I'm unable to get access into mysql via terminal. I've installed MAMP on my MacOS High Sierra (10.13.5).
Apache & MySQL started, but after prompting the command:
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
nothing happens.
P.S. Path leading to MAMP binaries is correct.
screen from terminal
Unfortunately, I didn't find solution at StOvfl.
I went through all similar or identical questions (this and this, for ex.) but still can't solve the problem.
I am on Xenial and have MySQL 5.7.12. I do not remember setting any password during installation (if it asked, I provided empty one).
I tried to go through password reset using --skip-grant-tables, as described here, it updated the database row, but I still cannot login.
Reconfiguring with sudo dpkg-reconfigure mysql-server-5.7 doesn't do anything, I get this:
Checking if update is needed.
This installation of MySQL is already upgraded to 5.7.12, use --force if you still need to run mysql_upgrade
$ sudo dpkg-reconfigure --force mysql-server-5.7
Checking if update is needed.
This installation of MySQL is already upgraded to 5.7.12, use --force if you still need to run mysql_upgrade
Any ideas?
MySQL 5.7 generates a random root password by itself on installation.
This was a new change in MySQL 5.7.4, and described in the release notes: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-4.html
The installation process creates only a single root account,
'root'#'localhost', automatically generates a random password for this
account, and marks the password expired. The MySQL administrator must
connect as root using the random password and use SET PASSWORD to
select a new password. (The random password is found in the
.mysql_secret file in the home directory of the effective user running
the script.)
I never find the .mysql_secret file, but the random password is also output in the MySQL error log (e.g. /var/log/mysqld.log on Linux). The notice looks like this:
2016-07-11T15:59:54.922316Z 1 [Note] A temporary password is generated for root#localhost: f14_W1lN7FfP
You could either reinstall everything, which i did. I had initially installed using macos package installer. That didn't get me anywhere.
So uninstalled everything, then upgraded brew, and installed via brew. Running the mysql shell proved a messy affair. Ultimately what worked was mysql -u root -p.
I was running it on localhost, so turns out root password wasn't required. Weirdly, mysql -u root -p <password> threw the "access denied" message.
Proper re-installing helped. Removed everything associated (this instruction, but it is important to specify the version of mysql, e.g. apt-get --yes purge mysql-server-5.7 mysql-client-5.7, and I also deleted mysql-common and all dependencies to be sure).
Then installed again (apt-get install mysql-server mysql-client) and when it asked for a password, this time, I gave it one. It works now.
I have been learning Ruby on Rails and have been using the command line successfully to view and edit the database (using the mysql command).
I am now using MAMP and trying to install Wordpress. It appears that it is using a "different" mysql. I.e., databases I create via the command line aren't viewable in MAMP's phpmyadmin, and vice versa.
How can I access MAMP's mysql via the command line? I'm guessing that I need to specify the host when logging in with the mysql command, but I'm not sure what to put there. Since phpmyadmin exists at localhost:8888/phpMyAdmin, I tried using mysql -h localhost:8888 -u root -p, but that didn't work (error: Unknown MySQL server host 'localhost:8888').
MAMP installs it's own MySQL which means that you now have two MySQL instances installed on you machine.
try typing this in your terminal
/Applications/MAMP/Library/bin/mysql
You can also add this to your a bash_profile so you don't have to write /Applications/MAMP/Library/bin/mysql each time by running in terminal :
sudo vi ~/.bash_profile
and adding
alias mysql="/Applications/MAMP/Library/bin/mysql"
Then, from terminal you can run : mysql -uroot -proot notice theres no space for this to work.