I've gotten a new laptop and after installing the newest version of xampp I cant log in to mysql as -u root.
I made sure that mysql is turned on in xampp.
Lines I've tried
cd\xampp\mysql\bin>mysql.exe -u root -p
cd\xampp\mysql\bin -u root -p
I've also tried starting mysql.exe directly and couldnt log in with similair commands.
The default setup of Xampp does not set a root password in mysql.
Try connecting without the -p. c:\xampp\mysql\bin\mysql.exe --user=root
The following is from the FAQ - https://www.apachefriends.org/faq_windows.html
Is XAMPP production ready?
Here a list of missing security in XAMPP:
The MySQL administrator (root) has no password.
Related
I was given a code repo which requires mysql in command line.
I am using Mac OS 10.11
First, I installed MySQL Community Server from http://dev.mysql.com/downloads/mysql/ and install it by running the PKG file.
After that, I opened System Preferences to start MySQL Server.
Then, I tried to execute
/usr/local/mysql/bin/mysql -uroot
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?
Thanks,
Typically the command is:
/usr/local/mysql/bin/mysql -u root -p
which will prompt you for your root password (which might be blank unless you changed it)
You can also use:
/usr/local/mysql/bin/mysql -u root -p[password]
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';
FLUSH PRIVILEGES;
exit
sudo /usr/local/mysql/support-files/mysql.server start
Which
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.
I am trying to connect to mysql server in ubuntu 12.04 from terminal
using and password empty("")
mysql -u root -p
it throwing error
ERROR 2002 (HY000): Can't connect to mysql server through socket 'var/run/mysql/mysqld.sock'(2)
Though i am able to access database successfully from phpmyadmin and there i see there is no password for root in user user table in mysql database.
I am using xampp package
I think the error is the socket file. Where did you install your xampp?
Can you try this,
mysql -u root -p --socket=/opt/xampp/var/mysql/mysql.sock
where opt is your installation directory. Change opt to your installation directory.
edit:
Or if you don't want using socket parameter on your mysql command, you can try
ln -s /opt/xampp/var/mysql/mysql.sock /var/run/mysql/mysqld.sock
Thanks.
what i can guess about your problem:following
If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with
socket=/var/lib/mysql/mysql.sock
you can check if mysql is running with the following command:
mysqladmin -u root -p status
try changing your permission to mysql folder. If you are working locally, you can try:
sudo chmod -R 755 /var/lib/mysql/
that solved it for me
I am trying to install openEMM on a Centos 6 VDS and have run into a snag. I am following the instructions on this page: http://www.roothelp.net/install-openemm-on-centos-6-x/. Everything has gone along fine until I reached the following commands:
service mysqld start
/usr/bin/mysql_secure_installation
cd /usr/share/doc/OpenEMM-2013/
mysqladmin -u root -p create openemm
The service starts fine, but when I run /usr/bin/mysql_secure_installation I get the following:
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and you
haven't set the root password yet, the password will be blank, so you
should just press enter here.
Enter current password for root (enter for none):
This is where the problems start. Apparently Plesk 11 does not create a root user account, using "admin" instead. None of my passwords work here, neither my actual SSH root password, my admin password, or any other password I've assigned. I even started mysql with this script to ensure I had the correct root password:
>UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
>FLUSH PRIVILEGES;
I tried this to ensure I had the correct password: /usr/local/psa/bin/admin --show-password
None of this has worked, and I am unable to run the command. How can I get around this? If I skip that command (GoDaddy support advised me that it was only configuring MySql, which is already installed with Plesk) and try to run
mysqladmin -u root -p create openemm
I am again asked for a root password and none work. I also tried this command instead, using the admin password but still had the same problem.
mysqladmin -u admin -p create openemm
I suspect I'll have to create a database called openemm through Plesk. Any ideas?
If you haven't set the mysql root password you can set it through the command
`$> mysqladmin -u root password "yourpassword"`
and if you want to change (or update) a root password, then you need to use the following command:
$> mysqladmin -u root -p'oldpassword' password newpass
Then you can create your database. In your case I think the mysql root password is just entered as the secure script asked you.
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?
(Updated for 2017)
When you installed MySQL it generated a password for the root user. You can connect using
/usr/local/mysql/bin/mysql -u root -p
and type 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
/usr/local/mysql/bin/mysql -u root
open terminal and type
sudo sh -c 'echo /usr/local/mysql/bin > /etc/paths.d/mysql'
then close terminal and open a new terminal and type
mysql -u root -p
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
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
In the terminal, I typed:
/usr/local/mysql/bin/mysql -u root -p
I was then prompted to enter the temporary password that was given to me upon completion of the installation.
In MacOS, Mysql's executable file is located in /usr/local/mysql/bin/mysql and you can easily login to it with the following command:
/usr/local/mysql/bin/mysql -u USERNAME -p
But this is a very long command and very boring, so you can add mysql path to Os's Environment variable and access to it much easier.
For macOS Catalina and later
Starting with macOS Catalina, Mac devices use zsh as the default login shell and interactive shell and you have to update .zprofile file in your home directory.
echo 'export PATH="$PATH:/usr/local/mysql/bin"' >> ~/.zprofile
source ~/.zprofile
mysql -u USERNAME -p
For macOS Mojave and earlier
Although you can always switch to zsh, bash is the default shell in macOS Mojave and earlier and with bash you have to update .bash_profile file.
echo 'export PATH="$PATH:/usr/local/mysql/bin"' >> ~/.bash_profile
source ~/.bash_profile
mysql -u USERNAME -p
install homebrew via terminal
brew install mysql
This command works for me:
./mysql -u root -p
(PS: I'm working on mac through terminal)
In terminal
sudo sh -c 'echo /usr/local/mysql/bin > /etc/paths.d/mysql'
Close that and open new terminal
mysql -u root -p
Give your password
For mac OS Catalina :
/usr/local/mysql/bin/mysql -uroot -p
This will prompt you to enter password of mysql
You can simply type in Terminal
brew services start mysql
if you installed mysql via brew on mac
If 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:
Command:
mysql --host=localhost -uroot -proot
try with either of the 2 below commands
/usr/local/mysql/bin/mysql -uroot
-- OR --
/usr/local/Cellar/mysql/<version>/bin/mysql -uroot
Im a newbie in ubuntu. Im getting an error while installing phpmyadmin in ubuntu11.4 server. It says
An error occurred while installing the database:
ERROR 1045 (28000):Access denaid for user 'root'#'localhost' (using password:YES);
I am sure that I used the correct password for root. I can login to mysql through putty.
Do I need to do anything with privileges?
Please help me to sort this issue.
I suggest:
mysql -h localhost -u root -p
and you typed something else. :(
pidof mysqld says what exactly? If nothing then sudo service mysql start and try
mysql -h localhost -u root -p
again.
Re-configure mysql-server:
sudo dpkg-reconfigure mysql-server
or
sudo dpkg-reconfigure mysql-server-5.1
whichever one is installed.
Once you reconfigure (and recover) your root mysql password, then
Reconfigure phpmyadmin
sudo dpkg-reconfigure phpmyadmin
i ran into the same issue and just figured my problem. I used an "ΓΌ" in my Root user's password. It seems like PHPMYADMIN can't handle the utf-8 set. So I altered the password to "abc" and it worked! Just dont forget to undo your temporary password :)
I got the same issue and installed my machine again, because I though I did something wrong. But same problem after re-installation of Ubuntu.
What works for me is to install mysql-server and phpmyadmin NOT as root user. I create a new user adduser admin and put them into the sudo group with adduser admin sudo. After that, I exit my ssh-connection with the root-account and login with the new admin-user. Now, I install both software-bundles and, suprise, all works fine.