# before i install SQL

## kraylus

i already attempted to install sql on the last machine and things went horribly wrong.

i  used mysql.

i intend to use it again too. i want to use some kinda of CMS portal like geeklog or phpnuke so i'm forced to use sql.

my question is... after i emerge php, apache, sql and whatnot, what steps do i have to take to get sql working. the last time i tried it i was attempting to login and create a database and sql wouldn't let me login no matter what un and pw i used.

sooo... all im going to do is emerge it for now. if anyone can tell me what steps to take or point me to a document that can, i'd appreciate it  :Very Happy: 

ryan

----------

## klieber

 *kraylus wrote:*   

> i want to use some kinda of CMS portal like geeklog or phpnuke so i'm forced to use sql.

 

Don't use phpNuke.  Use PostNuke instead.  It's a fork from phpNuke that focuses on stability and security.  It's also developed by a group of Open Source developers, whereas phpNuke is controlled by one (some would say facist) developer...

 *kraylus wrote:*   

> my question is... after i emerge php, apache, sql and whatnot, what steps do i have to take to get sql working.

 

First of all, make sure you have 'mysql' defined as a USE variable.

 *kraylus wrote:*   

> the last time i tried it i was attempting to login and create a database and sql wouldn't let me login no matter what un and pw i used.

 

By default, "root" is the username with a blank password.

 *kraylus wrote:*   

> sooo... all im going to do is emerge it for now. if anyone can tell me what steps to take or point me to a document that can, i'd appreciate it 

 

By far your best source is the MySQL manual, which will tell you, among other things, what the default privilages are as well as how to reset a forgotten root password.

--kurt

----------

## kraylus

ok, ive reinstalled mysql finally....

i followed the instructions that i was given after running mysql_install_db script which were to start the mysql server, and do this:

```

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

/usr/bin/mysqladmin -u root -h gentoo.kraylus.com -p password 'new-password'
```

then i tried to login to the mysql server via:

```

mysql -u root -p new-password

Enter password: new-password

ERROR 1049: Unknown database 'new-password'
```

please note that all instances of "new-password" are replaced with my actual password.

im new to mysql so if anyone can shed some light on this.

i followed the instructions listed on default permissions and whatnot at the official mysql docs, but im getting the same errors OR im getting "you dont have permission".

thanks for your help.

ryan

----------

## amasidlover

if you add the the syntax of mysql client is 

```
mysql <options> <database name>
```

Therefore mysql client will interpret what you wrote as a request to access the database your_password. Since you left a space between -p and your_password.

I'd firstly try 

```
mysql -u root
```

 with nothing else.

I'd also be a bit wary of using the password on the command line if the database is supposed to be secure....

----------

## Ferdy

Don't use phpNuke either postNuke use ez Publis http://developer.ez.no/developer/ezpublish wich is much better IMHO.

And to get mysql working you should do:

```

[bash]# mysql -p

Password: [enter your password]

mysql>

```

Don't specify the database either the password in the command line

Just My 2 Cents

----------

## analog

Kraylus, I had the same problem as you (can't access mysql as root) and what it turned out to be was a problem with actual "mysql" database not containing the correct user privilege entries. I have no idea what caused this, evidently it was some sort of problem the first time I ran the mysql_install_db script.

To get things working, I killed the whole mysql database directory (usually /var/lib/mysql) and then ran the mysql_install_db script again. After that, things worked like a charm.

Note: Simply running the mysql_install_db script without erasing the directory won't work, as the script is designed to leave any existing tables/databases intact. It only took me about a dozen tries to realize this  :Smile: 

----------

## dj_choco

 *analog wrote:*   

> 
> 
> To get things working, I killed the whole mysql database directory (usually /var/lib/mysql) and then ran the mysql_install_db script again. After that, things worked like a charm.
> 
> Note: Simply running the mysql_install_db script without erasing the directory won't work, as the script is designed to leave any existing tables/databases intact. It only took me about a dozen tries to realize this 

 

You are correct  :Very Happy:  Thank you! Now I can start using mysql

----------

