mysql connect ubuntu

Hello
New to ubuntu and just downloaded mysql using sudo apt-get install mysql-server
--seemed to be ok - then type in mysql and got the following...
ERROR 1045 (28000): Access denied for user 'philipsivyer'@'localhost' (using password: NO)
how do I get round this please
philsivyerAsked:
Who is Participating?
 
jeff_01Commented:
One more thing, perhaps you need to set a password before you will be able to gain access.

Try,

mysqladmin -u root password 'new-password'

To set a new password
0
 
BarthaxCommented:
A default installation will have only one SQL user: root.  Use:

mysql -u root
0
 
jeff_01Commented:
You need to connect using the root account until you have set up more mysql users

mysql -u root

I believe the default password is blank.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
philsivyerAuthor Commented:
Hello
TRied that - Now get this
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
0
 
BarthaxCommented:
OK, so there must be a password on the SQL root account - presumably you were requested to enter one during the install?

mysql -u root -p

Using the above will give a password-prompt & should then allow you in.
0
 
jeff_01Commented:
Try

mysql -u root -p

Then when it prompts for the password just press enter and see how that goes.

When you installed did it not run a config script which asked for a root password? If it did try

mysql -u root -p password

0
 
philsivyerAuthor Commented:
Hello
It did not prompt me for a password on the install and the strange thing is that when I open the Terminal and type mysql -u root -p it then goes to new line which is .. Enter password: - which is fine but for some reason I am unable to type anything in - weird! when I hit return for a new prompt then it's ok and I can type in anything I want.
0
 
BarthaxCommented:
You will not receive any echo when typing the password: whatever you type during the password prompt will not be displayed. Have you tried simply pressing return?
0
 
philsivyerAuthor Commented:
Yes
I get ..
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
0
 
BarthaxCommented:
That confirms the SQL has been set up with a password.  I've never looked into password-cracking on MySQL, so I'm not about to suggest anything in that direction.  Has the machine ever had MySQL installed before? If so, it is potential that an old system DB is inplace & the new install just picked up where that left off.  If this is a truly brand new install, I would suggest uninstalling (sudo apt-get remove mysql-server) and then re-install.
0
 
philsivyerAuthor Commented:
It has had a previous version - I will remove and re-install
0
 
philsivyerAuthor Commented:
Does this make any more sense .. still not working ..
sudo apt-get remove mysql-server
[sudo] password for philipsivyer:
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.31-14 libnet-daemon-perl libhtml-template-perl libdbi-perl
  libdbd-mysql-perl mysql-server-5.1 mysql-client-5.1 libplrpc-perl
  mysql-server-core-5.1 linux-headers-2.6.31-14-generic
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED
  mysql-server
0 upgraded, 0 newly installed, 1 to remove and 66 not upgraded.
After this operation, 102kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 166965 files and directories currently installed.)
Removing mysql-server ...
philipsivyer@ubuntu:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree        
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.31-14 linux-headers-2.6.31-14-generic
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed
  mysql-server
0 upgraded, 1 newly installed, 0 to remove and 66 not upgraded.
Need to get 0B/63.9kB of archives.
After this operation, 102kB of additional disk space will be used.
Selecting previously deselected package mysql-server.
(Reading database ... 166962 files and directories currently installed.)
Unpacking mysql-server (from .../mysql-server_5.1.37-1ubuntu5_all.deb) ...
Setting up mysql-server (5.1.37-1ubuntu5) ...
philipsivyer@ubuntu:~$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
philipsivyer@ubuntu:~$ mysql
ERROR 1045 (28000): Access denied for user 'philipsivyer'@'localhost' (using password: NO)
philipsivyer@ubuntu:~$ mysqladmin -u root password 'blktbhl7'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
philipsivyer@ubuntu:~$
0
 
BarthaxCommented:
You mentioned that this was not the first time MySQL had been installed.  The new installation must be using the old databases - those old databases must be set up so that the MySQL root user has a password.  Have you inherited this installation & therefore unaware of the password or is there a previous admin (or yourself) which would have access to that password?
0
 
philsivyerAuthor Commented:
I have a dual system using Windows and Ubuntu - mysql is already installed with Windows - would that have any impact?
0
 
jeff_01Commented:
Follow the instructions in the link below to reset the mysql root password. You need to be logged in as root on the system.

"su"

http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

0
 
BarthaxCommented:
I doubt it, however, the simplest method to finding out would be to see if the root password for the Windows' MySQL installation works on this new install.

If that simple test fails, try the following:

mysqladmin -u root password <mynewpassword>

(Obviously replace <mynewpassword> with what you want to use.)  If that requires you to enter a password (access denied), then I'm very close to being stumped.
0
 
philsivyerAuthor Commented:
Hello
Went back to Windows opened myssql with no problem and password was accepted - now back in ubuntu and still have same problems - tried resetting pasword but still get ..
connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

I guess if all else fails I go back to Windows
0
 
jeff_01Commented:
Sorry, I didnt read Barthax's exact same post.

Nevermind me  :(
0
 
jeff_01Commented:
Did you try the procedure in the link I posted above?

0
 
philsivyerAuthor Commented:
I'm trying the link and got to the part where it says ..................

You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the path name of the .pid file in the following command:
shell> kill `cat /mysql-data-directory/host_name.pid`

my path to file mysql.pid is ... /var/run/mysqld so what would now be the command now
shell> kill 'cat/????????
0
 
philsivyerAuthor Commented:
OK
Ignore previous comment - now on next part of the process
Phil
0
 
philsivyerAuthor Commented:
Hello
Tried the kill process but permission denied - I think I will uninstall and use windows where mysql works
0
 
philsivyerAuthor Commented:
I'm bowing out for a few hrs - gone to take a frustration pill
0
 
BarthaxCommented:
Just skimmed of the Unix instructions in that MySQL instructions & noticed this bit:

> 1. Log on to your system as the Unix mysql user that the mysqld server runs as.

Try running through the instructions as (Linux) root instead.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.