I can't use mysql

Asked by pdo100

Recently I installed Apache2, php and mysql... I configured apache2 and the www folder is now in my user folder and I can access easily and do some stuff... now I am due to use mysql and when I go to terminal and try to start mysql or do anything with it I get message: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
How can I make it working? how can I start doing something with mysql? I need to use GUI option for other apache work, so how is it possible to use terminal while logged on as user?

BTW I am the only user on the machine...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu mysql-dfsg-5.0 Edit question
Assignee:
No assignee Edit question
Solved by:
Sean Sosik-Hamor
Solved:
Last query:
Last reply:
Revision history for this message
tiger69 (andrei-lupu) said :
#1

to acces the terminal :applications->accesories->terminal
the so called error is not related to ubuntu
try to use "-u root" option when working with mysql
try to connect from inside a php script

Revision history for this message
mrog (michael-studiomeister) said :
#2

Mysql has it's own users which are different from the system users. At some point the mysql root user was assigned a password and expects that password to be provided when using mysql.
(i.e. mysql -u root -prootpassword databasename) (no space after -p)

You might need to reset the mysql root password for this to work. Details are here:
http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

Revision history for this message
pdo100 (piotrdomowicz) said :
#3

As far as I read from mysql site once it was install root username was given and password was not setup... so why I still have the same problem when typing ~mysql - root

I managed to change the root password but the same message appears on screen: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I tried to type:
:~$ mysql -u root -p
:~$ password: *****

and still the same...

Revision history for this message
pdo100 (piotrdomowicz) said :
#4

and also when I type ~: mysqld
following message comes on the screen:

070902 19:29:23 [Warning] Can't create test file /var/lib/mysql/my-ubuntu.lower-test
070902 19:29:23 [Warning] Can't create test file /var/lib/mysql/my-ubuntu.lower-test
070902 19:29:23 [Warning] One can only use the --user switch if running as root

070902 19:29:23 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

Revision history for this message
Best Sean Sosik-Hamor (sciri) said :
#5

pdo100, you're receiving permission errors because the mysql daemon needs to be started with root privs:

sudo /etc/init.d/mysql start

Revision history for this message
pdo100 (piotrdomowicz) said :
#6

Thanks Sean Sosik-Hamor, that solved my question.

Revision history for this message
Pat Shamblin (patshamblin) said :
#7

I got the same problem, so what do I do after this ?
sudo /etc/init.d/mysql start