Link to home
Start Free TrialLog in
Avatar of philsivyer
philsivyer

asked on

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
Avatar of Barthax
Barthax
Flag of United Kingdom of Great Britain and Northern Ireland image

A default installation will have only one SQL user: root.  Use:

mysql -u root
Avatar of jeff_01
jeff_01

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.
Avatar of philsivyer

ASKER

Hello
TRied that - Now get this
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
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.
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

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.
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?
Yes
I get ..
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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.
It has had a previous version - I will remove and re-install
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:~$
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?
I have a dual system using Windows and Ubuntu - mysql is already installed with Windows - would that have any impact?
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

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.
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
ASKER CERTIFIED SOLUTION
Avatar of jeff_01
jeff_01

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, I didnt read Barthax's exact same post.

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

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/????????
OK
Ignore previous comment - now on next part of the process
Phil
Hello
Tried the kill process but permission denied - I think I will uninstall and use windows where mysql works
I'm bowing out for a few hrs - gone to take a frustration pill
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial