# mysql help

## scap1784

i just installed mysql and i have never used it before i am trying to set the root password so i can use phpmyadmin however i am having difficulty.

```

root@scaparra scap # mysqladmin -u root password 'password'

mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'

Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

root@scaparra scap # /etc/init.d/mysql start

 * Starting mysqld...                                                     [ ok ]root@scaparra scap # mysqladmin -u root password 'password'

mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user: 'root@localhost' (Using password: NO)'

root@scaparra scap #

```

What am i doing wrong

----------

## Highlands

test

```

mysql

```

if it doesn't work try 

```

mysql -p 'password'

```

----------

## scap1784

```

root@scaparra scap # mysql -p 'password'

Enter password:

ERROR 1049: Unknown database 'password'

```

----------

## xedx

did you already do

```
/usr/bin/mysql_install_db
```

----------

## Iron_Mike

i have the same problem as the above, having already ran /usr/bin/mysql_install_db

I still get the error:

```

Enter password: 

ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

```

sorry to break in

----------

## slartibartfasz

@scap

```

mysql -u root

```

if u get to the mysql shell set the password:

```

mysql> use mysql;

mysql> SET PASSWORD FOR root@localhost=PASSWORD('new_password');

```

if this does not work, go to the mysql.com homepage and take look at the instructions for resetting the root password...

@Iron_Mike

sorry if this is too obvious (but hey u never know) - did u start the server?

 *Quote:*   

> 
> 
> /etc/init.d/mysql start
> 
> 

 

if yes, take a look at the sockets - perhaps there is a dead one left over from a crash. if this is also not the case, check permissions on /var/run/mysql - has to be writeable by mysql...

----------

## scap1784

yea i did start the server and noo i can't get into the shell because for some reason it has a password and i never set one as for installdb this is what it prints...

```

root@scaparra scap # mysql_install_db

Installing all prepared tables

030618  5:47:32  /usr/sbin/mysqld: Shutdown Complete

 

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

This is done with:

/etc/init.d/mysql start  (you have to start the server first!)

/usr/bin/mysqladmin -u root  password 'new-password'

/usr/bin/mysqladmin -u root -h scaparra.com  password 'new-password'

See the manual for more instructions.

 

NOTE:  If you are upgrading from a MySQL <= 3.22.10 you should run

the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be

able to use the new GRANT command!

 

Please report any problems with the /usr/bin/mysqlbug script!

 

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at https://order.mysql.com

 

```

however i get the same problems as above after doing that

----------

## Iron_Mike

@slart

the place where the sockets is suppose to be is empty

(if only i knew what a socket is  :Smile:  )

yes it is started...it starts correctly (with the green [ok]) and all but when i try things with mysqladmin <whatever option> then the message appears

and  /var/run/mysqld (wich is empty)

drwxr-xr-x    2 mysql    mysql          48 Jun 17 19:53 mysqld

any other ideas?Last edited by Iron_Mike on Wed Jun 18, 2003 7:00 pm; edited 1 time in total

----------

## Iron_Mike

ok, what i have found is that i should have a file mysql.sock in /var/lib/mysql...

its nowhere to be found on my system...c!!!

----------

## slartibartfasz

ok - maybe this helps:

 *Robin Johnson wrote:*   

> 
> 
> It works here for me, with one minor change.
> 
> 1. ebuild /var/db/pkg/dev-db/mysql*/*.ebuild config
> ...

 

replace 'darkstar' with your hostname [OT: great film btw - i mean darkstar  :Razz: ]

----------

## Iron_Mike

yup

when starting mysql without giving a hostname in parameter, results in mysql trying to connect thru the sockets, wich doesnt exist on my server

but if i go

mysql -h hostname

it works...

i guess what you wrote in your other reply is to make mysql look for hostname by default

other problem, i cant make the regular users able to create or modify table other than the test one...

only root can achieve it, how can i make it that all my users can create their own table

----------

## scap1784

This is prolly a retarded question but i am starting all over cause i think i really screwed this up but are you suposed to do this first:

```

/usr/bin/mysql_install_db

```

----------

## scap1784

ok i think i got it but i don't really understand if i set a password or not is my password "new-password" for the root user?? also just typeing mysql in a terminal brings up the monitor now.

```

root@scaparra mysql # mysql_install_db

Preparing db table

Preparing host table

Preparing user table

Preparing func table

Preparing tables_priv table

Preparing columns_priv table

Installing all prepared tables

030618 18:39:55  /usr/sbin/mysqld: Shutdown Complete

 

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

This is done with:

/etc/init.d/mysql start  (you have to start the server first!)

/usr/bin/mysqladmin -u root  password 'new-password'

/usr/bin/mysqladmin -u root -h scaparra.com  password 'new-password'

See the manual for more instructions.

 

Please report any problems with the /usr/bin/mysqlbug script!

 

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at https://order.mysql.com

 

root@scaparra mysql # /etc/init.d/m

metalog  modules  mysql

root@scaparra mysql # /etc/init.d/mysql start

 * WARNING:  "mysql" has already been started.

root@scaparra mysql # /etc/init.d/mysql stop

 * Stopping mysqld...                                                     [ ok ]root@scaparra mysql # /etc/init.d/mysql start

 * Starting mysqld...                                                     [ ok ]root@scaparra mysql # mysqla

mysqlaccess   mysqladmin    mysqlanalyze

root@scaparra mysql # mysqladmin -u root -h scaparra.com password 'new-password'root@scaparra mysql #

```

----------

## Iron_Mike

anyone ever seen this:

cannot load MySQL extension,

please check PHP Configuration.

Documentation

----------

## slartibartfasz

 *scap1784 wrote:*   

> ok i think i got it but i don't really understand if i set a password or not is my password "new-password" for the root user?? also just typeing mysql in a terminal brings up the monitor now.
> 
> 

 

i took a look at it - seems that mysql didnt accept the passwd. u can check this by:

```

mysql -u root

mysql> select mysql;

mysql> select * from user;

```

u wont see any passwords set...

u can set a password by hand:

```

mysql -u root

myslq> set password=password('type-your-password-here');

```

----------

## slartibartfasz

 *Iron_Mike wrote:*   

> anyone ever seen this:
> 
> cannot load MySQL extension,
> 
> please check PHP Configuration.
> ...

 

when u do what?

[EDIT:] time for a new thread i think... (unless it is not covered elsewhere, there are a lot of threads about php+apache+mysql)

----------

## Iron_Mike

when trying to acess a page using php AND mysql

they are both running fine seperately, but when use 2gether this is the result

----------

## Senso

I had a similar problem with setting the root password a couple of months ago. If I remember correctly, I had to use the option '-u root@localhost' and not just '-u root'. 

Might help someone else...

----------

## scap1784

ok well thanks alot for the help guy but i broke down and went and just bought a O'REILY mysql book. It has helped alot. finally got it up with the right permissions and settings etc...

Thanks 

Scap

----------

