# Installation of MySQL fails - mysql_install_db does not work

## Starfox

HI folks,

when emerging MySQL on gentoo-1.4-rc1 i discovered an error while the needed installation script mysql_install_db is running. While searching forum and internet, i discovered no one had these problems before!???

Anyone here, who is able to imagine whats going wrong???

When runnning mysql_install_db following happens (even after many rebuilds with other USE and CFLAGS!):

```

root@btr0n32:~ $ mysql_install_db 

Preparing db table

Preparing host table

Preparing user table

Preparing tables_priv table

Preparing columns_priv table

Installing all prepared tables

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

ERROR: 1033  Incorrect information in file: './mysql/db.frm'

021006  0:32:54  /usr/libexec/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 btr0n32  password 'new-password'

See the manual for more instructions.

```

So far i see, a set of files namend 

```

root@btr0n32:~ $ l /var/lib/mysql/mysql/

total 16

-rw-rw----    1 mysql    mysql           0 Oct  3 01:02 func.MYD

-rw-rw----    1 mysql    mysql        1024 Oct  3 01:02 func.MYI

-rw-rw----    1 mysql    mysql        8641 Oct  3 01:02 func.frm

```

 are created, but when i try to start mysqld, i am told the following by /var/log/mysql/mysql.err

```

021006 00:36:05  mysqld started

021006  0:36:05  /usr/libexec/mysqld: Table 'mysql.host' doesn't exist

021006 00:36:05  mysqld ended

```

Anyone here discoverd (and solved) similar problems????

Thanks for help!

Starfox

----------

## rac

Is your hostname set up correctly?  What does the hostname command (or uname -a) report?  What sort of filesystem is /var/lib/mysql on?

----------

## fmalabre

 *Starfox wrote:*   

> When runnning mysql_install_db following happens (even after many rebuilds with other USE and CFLAGS!):

 

I don't have all those errors...

I run Gentoo 1.4 RC1, on an old mmx 166 (it took a while to compile!).

----------

## Starfox

 *rac wrote:*   

> Is your hostname set up correctly?  What does the hostname command (or uname -a) report?  What sort of filesystem is /var/lib/mysql on?

 

Hi,

normaly the hostname settings should be okay, as i am running exactly the settings on my LFS, and there it works!

```

pts/0: : 4 file(s) : 76Kb

root@btr0n32:~ $ hostname

btr0n32

pts/0: : 4 file(s) : 76Kb

root@btr0n32:~ $ hostname -s

btr0n32

pts/0: : 4 file(s) : 76Kb

root@btr0n32:~ $ hostname -f

btr0n32.rz.uni-bayreuth.de

root@btr0n32:~ $ uname -a

Linux btr0n32 2.4.19 #3 Thu Sep 26 11:46:12 CEST 2002 i586 AuthenticAMD

```

And /var/lib/mysql is on a reiserfs, just like on my working LFS!

I tried the mysql-3.23.52.ebuild and the mysql-3.23.52-r1.ebuild!

None of them fixed the problem.

While hacking in the mysql_install_db file i realized that the commands are right (hostname, etc.) but it sems like mysql can read the table format!!! How could this happen????

Thanks for help!

Starfox

----------

## rac

Weird.  I'm running a MySQL 4.0 prerelease here, so I can't duplicate your problem either.  You could try filing a bug report on https://bugs.gentoo.org.

EDIT: Moving from Installing Gentoo, which covers initial installation of the system, to Networking and Security, as MySQL generally is used as a networking daemon.

----------

## Starfox

hmm, maybe i should try the 4.0 version, too. Il report if that will solve my problem!

thx fox

----------

## RebelYell

I have the same problem, too...

----------

## Starfox

@Rebel:

What architectur do you have? I Have an AMD K6-300 MHz, and my USE is USE="... -berkdb innodb mysql..." CFLAGS="-O3 -march=k6 -fomit-frame-pointer" (but other flags did no difference!)

Fox

----------

## Starfox

Hmm, so i finaly found the bug (MAYBE, have to do some testing to proof that!).

When changing the CFLAGS to 

```
CFLAGS="-O3 -march=i586 -pipe -fomit-frame-pointer"
```

 ( _changed from -march=k6 to -march=i586 !!!!), I got a working MySQL! 

Seems like the gcc-3.2 produces bulls**t code while compiling mysql with -march=k6 !!!

Maybe anyone can proof my thesis, so we can fill a bug report, and fix the ebuild!

Fox

----------

## RebelYell

 *Starfox wrote:*   

> @Rebel:
> 
> What architectur do you have? I Have an AMD K6-300 MHz, and my USE is USE="... -berkdb innodb mysql..." CFLAGS="-O3 -march=k6 -fomit-frame-pointer" (but other flags did no difference!)
> 
> Fox

 

CPU: K6-2

CFLAGS: -03 -march=k6-2 -pipe -fomit-frame-pointer

Gentoo 1.4 UT2k3

----------

## RebelYell

 *Starfox wrote:*   

> Hmm, so i finaly found the bug (MAYBE, have to do some testing to proof that!).
> 
> When changing the CFLAGS to 
> 
> ```
> ...

 

Hmm... i guess you're right. I just tried the mysql ebuild on AthlonXP with -march=athlon-xp and guess what? Success!    :Laughing: 

I'll try later with that K6-2 using the i586 cflag and report the result.

Thanks for figuring out this one!

----------

## rac

Sorry it took me so long to get back on this, but I tried emerge mysql on my K6 (first generation), with GCC 3.2 and "-march=k6 -O2", and had no problems with mysql_install_db.  So maybe it's not only architecture-specific, but optimization flag specific also.

----------

## Starfox

Okay, i'll try out that one and report the results. Have you tried the -O3 and -march=k6 flag, too. What happend on your system then???

fox

----------

## RebelYell

 *Starfox wrote:*   

> Okay, i'll try out that one and report the results. Have you tried the -O3 and -march=k6 flag, too. What happend on your system then???
> 
> fox

 

I got a working mysql on k6-2 too   :Very Happy: 

Changing the k6-2 with i586 seems to be the trick...

----------

## Starfox

Fine, I will add a bug report to the "gentoozilla".

Thanks for help!

PS: Have you tried to install MySQL++1.7.9 ??

----------

## Starfox

SOLUTION for this problem:

This problem occures while using gcc-3.2, mysql*, and CFLAGS='-march=k6{-2}{-3} ...'.

Changing

```
CFLAGS='-march=k6{-2}{-3} ...'
```

into 

```
CFLAGS='-march=i586 ...'
```

does the trick, and solves the problem.

----------

