Page 1 of 1

MySQL at first time running

Posted: 8. Feb 2010, 17:46
by baran
Hi,

I installed mysql server on my Salix OS. I would like tu run it at 1st time. I did checked the checkbox in serveces after Startup. I did restart NTB ... :-( Error


root@darkstar:/etc/rc.d# mysqladmin -u root password root
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!
root@darkstar:/etc/rc.d# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
root@darkstar:/etc/rc.d# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
root@darkstar:/etc/rc.d# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
root@darkstar:/etc/rc.d# clear
.........


Can you help me, please? I can run it on Debian, CentOS, but I am not able to run it on SalixOS :-( THNX.

Rene

Re: MySQL at first time running

Posted: 8. Feb 2010, 17:54
by thenktor
Run the following to make the mysql start script executable:
chmod +x /etc/rc.d/rc.mysql

Initialize the database:
mysql_install_db

You also have to change ownership for the database:
chown -R mysql:mysql /var/lib/mysql

After that start mysql with:
/etc/rc.d/rc.mysql start

Re: MySQL at first time running

Posted: 8. Feb 2010, 18:06
by baran
Great, it works. THNX.


Rene

Re: MySQL at first time running

Posted: 9. Feb 2010, 04:28
by prfaasse
Not to contradict Thenktor :D

You also might want to have a look at the contents of the file /etc/rc.d/rc.mysqld: there is a 'mini-mini-mini manual' inside as to how to actually make sure that mysqld (the mysql daemon) is to be properly initialized and/or configured. The remarks from Thenktor are 'there', as well as some info about what to do if you want to have your database-server accessible from the network (another machine using the mysql on your machine) and the like.

Re: MySQL at first time running

Posted: 9. Feb 2010, 09:23
by JRD
thenktor wrote: Initialize the database:
mysql_install_db

You also have to change ownership for the database:
chown -R mysql:mysql /var/lib/mysql
Instead, su to the mysql user and run mysql_install_db. You should also run mysql_secure_installation after running the mysqld deamon:

Code: Select all

[root]# su mysql
[mysql] $ mysql_install_db
[mysql] $ exit
[root] # service start mysqld
[root] # mysql_secure_installation

Re: MySQL at first time running

Posted: 9. Feb 2010, 09:36
by damNageHack
<troll mode="on">Use PostgreSQL</troll>

Re: MySQL at first time running

Posted: 9. Feb 2010, 13:25
by thenktor
JRD wrote:Instead, su to the mysql user and run mysql_install_db. You should also run mysql_secure_installation after running the mysqld deamon:

Code: Select all

[root]# su mysql
[mysql] $ mysql_install_db
[mysql] $ exit
[root] # service start mysqld
[root] # mysql_secure_installation
But this way you have to run the "chown" command before because AFAIR /var/lib/mysql belongs to root after package installation.

Re: MySQL at first time running

Posted: 9. Feb 2010, 18:09
by JRD
thenktor wrote:AFAIR /var/lib/mysql belongs to root after package installation.
No it's not.

Re: MySQL at first time running

Posted: 9. Feb 2010, 19:35
by thenktor
OK :)