installing mysql on openBSD, how??

i am quite new to the unix world and might need the help in small steps :-)



I have a openBSD server setup.

I have got two TGZ files, one for server and one for client.

when i unziped and untar the files i found a file called +INSTALL

this file looks like a script that will install the program.

when i run "./+INSTALL" i get an error of "usage: ./+INSTALL distname { PRE-INSTALL | POST-INSTALL }"

when i run it as "./+INSTALL mysql PRE-INSTALL" it runs off and sets up a new user of mysql and a group.
this looks good

the question is what to do next??

LVL 2
robsondeAsked:
Who is Participating?
 
ajaikumarrConnect With a Mentor Commented:
Hai,

Check whether you are able to connect to mysql... search for mysql directory (some where /lib/mysql or /user/local/mysql or /usr/local/share/mysql/mysql.server)

The command is something like
mysql -u root -D mysql
this will ask you the password just press enter if you have'nt given any password. it will take u to mysql prompt there you can enter some queries to check whether you have installed it correctly.
query ex :- select * from user;

If any of the above one fails then it seems your installation has problem.
http://dev.mysql.com/doc/mysql/en/Installing_source.html

Mysql client & server files are named as Mysql-server-**.tgz & Mysql-client-**.tgz, you can install tgz file by issuing command like [pkg_add mysql*]

To startup mysql automatically
Check /etc/rc.conf to make sure that the following line is at the bottom:
local_rcconf="/etc/rc.conf.local"

If it doesn't exist, create /etc/rc.conf.local and add:
mysql=YES

Provide permission like below
chmod 755 /usr/local/share/mysql/mysql.server
and add the below lines to /etc/rc.local
if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/safe_mysqld ]; then
      echo -n " mysqld"; /usr/local/share/mysql/mysql.server start
fi

reboot the system and check connecting to it.

Hope it helps you
Bye
Ajai
0
 
robsondeAuthor Commented:
it looks like i was going the wrong ay about installing it all......

i use the pkg_add thing like you said above and that looks like a good start.

things are still not working....

below is a bit of info you might be able to look at and see what i have wrong.

login as root i did some looking around and this is what i have got......


dobby# ls
.cshrc   altroot  boot     dev      home     root     stand    tmp      var
.profile bin      bsd      etc      mnt      sbin     sys      usr
dobby# cd /usr/local/bin
dobby# ls
mysql           mysqlbinlog     mysqldump       mysqlimport     mysqltest
mysqladmin      mysqlcheck      mysqldumpslow   mysqlshow
dobby# ./mysql
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/m
ysql.sock' (2)
dobby#
dobby# ls -al
total 243
drwxr-xr-x   2 root  wheel    512 Aug  3 14:01 .
drwxr-xr-x  11 root  wheel    512 Aug  1 17:40 ..
-r-xr-xr-x   1 root  bin    49152 Jan 31  2003 mysql
-r-xr-xr-x   1 root  bin    24576 Jan 31  2003 mysqladmin
-r-xr-xr-x   1 root  bin    36864 Jan 31  2003 mysqlbinlog
-r-xr-xr-x   1 root  bin    20480 Jan 31  2003 mysqlcheck
-r-xr-xr-x   1 root  bin    32768 Jan 31  2003 mysqldump
-r-xr-xr-x   1 root  bin     4986 Jan 31  2003 mysqldumpslow
-r-xr-xr-x   1 root  bin    20480 Jan 31  2003 mysqlimport
-r-xr-xr-x   1 root  bin    20480 Jan 31  2003 mysqlshow
-r-xr-xr-x   1 root  bin    36864 Jan 31  2003 mysqltest
dobby#
dobby# cd /etc
dobby# cat passwd
root:*:0:0:Charlie &:/root:/bin/csh
daemon:*:1:1:The devil himself:/root:/sbin/nologin
operator:*:2:5:System &:/operator:/sbin/nologin
bin:*:3:7:Binaries Commands and Source,,,:/:/sbin/nologin
smmsp:*:25:25:Sendmail Message Submission Program:/nonexistent:/sbin/nologin
popa3d:*:26:26:POP3 server:/var/empty:/sbin/nologin
uucp:*:66:1:UNIX-to-UNIX Copy:/var/spool/uucppublic:/usr/libexec/uucp/uucico
www:*:67:67:HTTP server:/var/www:/sbin/nologin
named:*:70:70:BIND Name Service Daemon:/var/named:/sbin/nologin
proxy:*:71:71:Proxy Services:/nonexistent:/sbin/nologin
nobody:*:32767:32767:Unprivileged user:/nonexistent:/sbin/nologin
robsonde:*:1000:10::/home/robsonde:/bin/csh
mysql:*:1001:1000:MySQL Account:/nonexistent:/sbin/nologin
dobby#cat group
wheel:*:0:root,robsonde
daemon:*:1:daemon
kmem:*:2:root
sys:*:3:root
tty:*:4:root
operator:*:5:root
bin:*:7:
news:*:8:
wsrc:*:9:
users:*:10:
auth:*:11:
games:*:13:
staff:*:20:root
smmsp:*:25:
popa3d:*:26:
guest:*:31:root
utmp:*:45:
www:*:67:
network:*:69:
named:*:70:
proxy:*:71:
dialer:*:117:
nogroup:*:32766:
nobody:*:32767:
mysql:*:1000:
dobby#
dobby#
dobby#
dobby#
















0
 
ajaikumarrCommented:
Hai,

As i dont have OpenBSD on my system... i can guide you (but can't test it here sorry)...

Check whether MYSQL has been started or start it using
mysql.server start

Bye
Ajai
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ajaikumarrCommented:
Hai,

After that try this command this is result you the version if so it's started and working properly.
./mysqladmin version

Bye
Ajai
0
 
robsondeAuthor Commented:

as far as i can see mysql is not running.

i cant find a mysql.server script......

0
 
robsondeAuthor Commented:
dobby# ./mysqladmin version
./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' ex
ists!
dobby# cd /var/run/mysql
/var/run/mysql: No such file or directory.
dobby#
0
 
ajaikumarrCommented:
Hai,

Sorry...

Also apply this.
chown -R mysql /user/local/mysql/*
chgrp daemon /user/local/mysql/*

0
 
ajaikumarrCommented:
Hai,

Could you please check on these locations to
    /var/run/mysqld/mysqld.sock
    /var/tmp/mysql.sock
    /var/run/mysql/mysql.sock
    /var/lib/mysql/mysql.sock
    /var/mysql/mysql.sock
    /usr/local/mysql/var/mysql.sock
    /Private/tmp/mysql.sock
    /tmp/mysql.sock

Bye
Ajai
0
 
ajaikumarrCommented:
Hai,

Please check the content of my.cnf (prob on /etc) something similar to the following:
socket=/tmp/mysql.sock
port = 3306

[mysqld]
socket=/tmp/mysql.sock
port = 3306

Bye
Ajai
0
 
robsondeAuthor Commented:
no i cant find mysql.sock or mysqld.sock in any of those locations.

0
 
robsondeAuthor Commented:
i am  not finding my.conf anywhere sorry.

0
 
ajaikumarrCommented:
Hai,

Cumulative steps to install MYSQL on OpenBSD.

<Let us assume MYSQL is getting installed on /usr/local/bin/mysql)
1. Installing MYSQL on OpenBSD
   pkg_add mysql*
   
2. Granting Permisison for temporary files
   chown -R mysql /usr/local/bin/mysql/*
   chgrp daemon /usr/local/bin/mysql/*
   chmod 755 /usr/local/bin/mysql/*

3. Checking for Values on my.cnf file
   This file will be probably available under /etc or current folder. The below lines should be available inside my.cnf.
   socket=/tmp/mysql.sock
   port = 3306

   [mysqld]
   socket=/tmp/mysql.sock
   port = 3306

4. Starting MYSQL
   mysql start
   
5. Checking connection status
   mysqladmin version
   
6. Auto starting MYSQL
   Check /etc/rc.conf to make sure that the following line is at the bottom:
   local_rcconf="/etc/rc.conf.local"

   If /etc/rc.conf.local doesn't exist, create /etc/rc.conf.local and add:
   mysql=YES
   if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/safe_mysqld ]; then
      echo -n " mysqld"; /usr/local/share/mysql/mysql.server start
   fi

Bye
Ajai
0
 
ajaikumarrCommented:
Hai,

If you can't find my.cnf then create a file and paste the below lines inside it (create it under /etc/my.cnf and copy it to /usr/local/bin also)
   [client]
   #password       = your_password
   port            = 3306
   socket          = /tmp/mysql.sock
   
   # The MySQL server
   [mysqld]
   port            = 3306
   socket          = /tmp/mysql.sock

Bye
Ajai
0
 
robsondeAuthor Commented:
step 1 and 2 done ok.

step 3 is the first problem.....

i cant find my.cnf on the system..

"find / my.cnf" results in not file or folder

and i cant see a start script, i have looked in /usr/local/share

dobby# cd /usr/local/share
dobby# ls
dict     doc      examples misc     nls      skel
dobby#


0
 
ajaikumarrCommented:
Hai,

Ok... Let's go step by step...

If you can't find my.cnf search for my-small.cnf if you found it just copy it as /etc/my.cnf and check the values. If you can't find this too just create a file /etc/my.cnf and paste the following values. it should be something like (assuming /tmp folder has full permission for all the users)

   [client]
   #password       = your_password
   port            = 3306
   socket          = /tmp/mysql.sock
   
   # The MySQL server
   [mysqld]
   port            = 3306
   socket          = /tmp/mysql.sock

Bye
Ajai
0
 
robsondeAuthor Commented:
ok i have made a my.cnf like you asked and have one copy in /etc and one in /usr/local/bin

all the mysql bin files are in /usr/local/bin

0
 
ajaikumarrCommented:
Hai,

Great...

Now try step 4 & 5.

Bye
Ajai
0
 
robsondeAuthor Commented:

step 4 ......


you want me in the /usr/local/bin

as root??

dobby# cd /usr/local/bin
dobby# ./mysql start
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
 (2)
dobby# cd /tmp
dobby# ls -al
total 2
drwxrwxrwt   2 root  wheel  512 Aug  3 15:05 .
drwxr-xr-x  14 root  wheel  512 Aug  1 17:40 ..
dobby#






0
 
ajaikumarrCommented:
Hai,

It seems it's not able to create mysql.sock file... Please check the permission for user mysql on that folder. and also check for previous instance for mysql.

Bye
Ajai
0
 
robsondeAuthor Commented:


dont i have to start the mysqld

as far as i can see all users have access to /tmp and so any user should be able to make a mysql.sock file......

0
 
ajaikumarrCommented:
Hai,

Yep... If mysql user can create /tmp/mysql.sock then try starting mysql.

Bye
Ajai
0
 
robsondeAuthor Commented:
dobby# cd /usr/local/bin
dobby# ./mysql start
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
 (2)
dobby#



i thought i had to start the mysqld ????

problem is i cant find the mysqld file.


0
 
ajaikumarrCommented:
Hai,

Really sorry... I do not have Linux/BSD in my system that's why i'm not able to guide you properly...

Could you please try these commands.
1. To create .sock file
   mysqld --socket=/tmp/mysql.sock
   
2. To Configure mysql
   ./configure --prefix=/usr/local/bin
   
3. To create user tables
   ./scripts/mysql_install_db

Bye
Ajai
0
 
ajaikumarrCommented:
Hai,

Most prob. mysqld will be on /bin directory.

Bye
Ajai
0
 
ajaikumarrCommented:
Hai,

Sorry to ask you this question very lately... R u using mysql above 3.22?

Bye
Ajai
0
 
robsondeAuthor Commented:
dobby# ./mysqld --socket=/tmp/mysql.sock
Fatal error: Please read "Security" section of the manual to find out how to run
 mysqld as root!
040803 15:54:20  Aborting

040803 15:54:20  ./mysqld: Shutdown Complete

dobby#
0
 
ajaikumarrCommented:
Hai,

Try the 2nd and 3rd steps.

Bye
Ajai
0
 
robsondeAuthor Commented:
mysql version 3.23.55

0
 
ajaikumarrCommented:
Hai,

I've got some other way of installing mysql on openBSD. If you can please try this.
We did the first way so if possible try 2nd way or 3rd way

*******************************************************************************
                  1st Way  (Binary install)
*******************************************************************************
<Let us assume MYSQL is getting installed on /usr/local/bin/mysql)
1. Installing MYSQL on OpenBSD
   pkg_add mysql*
   
2. Granting Permisison for temporary files
   chown -R mysql /usr/local/bin/mysql/*
   chgrp daemon /usr/local/bin/mysql/*
   chmod 755 /usr/local/bin/mysql/*

3. Checking for Values on my.cnf file (If does not exist create it)
   This file will be probably available under /etc or current folder. The below lines should be available inside my.cnf.
   [client]
   socket=/tmp/mysql.sock
   port = 3306

   [mysqld]
   socket=/tmp/mysql.sock
   port = 3306

4. Starting MYSQL
   mysql start
   
5. Checking connection status
   mysqladmin version
   
6. Auto starting MYSQL
   Check /etc/rc.conf to make sure that the following line is at the bottom:
   local_rcconf="/etc/rc.conf.local"

   If /etc/rc.conf.local doesn't exist, create /etc/rc.conf.local and add:
   mysql=YES
   if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/safe_mysqld ]; then
      echo -n " mysqld"; /usr/local/bin/mysql/mysql start
   fi

*******************************************************************************
                        2nd Way (Binary install)
*******************************************************************************
1. Create a new my.cnf in your /etc directory, containing the following directives:
      [client]
      socket=/tmp/mysql.sock
      port = 3306

      [mysqld]
      socket=/tmp/mysql.sock
      port = 3306
      datadir=/export/data
      log=/var/log/mysql-messages
                                                                                                                             
2. Move the compressed archive from it's download location into a convenient build area
      cd /usr/src && mv /home/user/mysql-standard-4.0.13-pc-linux-i686.tar.gz .
                                                                                                                             
3. Extract and create a symlinked mysql directory
      tar -zxvf mysql-standard-4.0.13-pc-linux-i686.tar.gz
      ln -s mysql-standard-4.0.13-pc-linux-i686 mysql
                                                                                                                             
4. Create new mysql user
      /usr/sbin/groupadd mysql
      /usr/sbin/useradd -g mysql mysql
                                                                                                                             
5. Create a data directory
      mkdir /export/data
                                                                                                                             
6. Build the default mysql databases
      cd /usr/src/mysql
      scripts/mysql_install_db
      chown -R root  .
      chown -R mysql data
      chown -R mysql /export/data
      chgrp -R mysql .
                                                                                                                             
7. Finally, symlink to mysql's usual location
      cd /usr/local/
      ln -s /usr/src/mysql mysql
                                                                                                                             
8. Start server
      bin/mysqld_safe --user=mysql &

*******************************************************************************
            3rd Way (install MySQL from source on FreeBsd)
*******************************************************************************
1. Create user & group
      groupadd mysql
      adduser -g mysql mysql


2. To build MySql follow the next steps:
      mkdir /usr/local/mysql/data
      mkdir /usr/local/mysql/tmp
      mkdir /usr/local/mysql/var
      cd /usr/src
      tar -vzxf mysql-3.23-51.tar.gz
      cd /usr/src/mysql-3.23.51
      ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-unix-socket-path=/usr/local/mysql/tmp/mysql.socket
      make
      make install

3. Change ownership of the MySQL binaries to root and ownership of the data directory to the user that you will run mysqld as:
      chown -R root /usr/local/mysql
      chown -R mysql /usr/local/mysql/var
      chgrp -R mysql /usr/local/mysql

4. Granting permisison
      chmod 700 /usr/local/mysql/data
      chmod 700 /usr/local/mysql/var
      chmod 755 /usr/local/mysql/tmp

5. To start MySQL by hand, run:
      /usr/local/mysql/bin/safe_mysqld --user=mysql & (MySQL 3.x)
      /usr/local/mysql/bin/mysqld_safe --user=mysql & (MySQL 4.x)

6. If this is your first-time installation of MySQL, you'll need to set up the initial mysql database, which contains all database privilege information, and establish a mysqld root password.
      scripts/mysql_install_db
      mysqladmin -u root -p password 'new-password'
      mysqladmin -u root -h -p password 'new-password'

Bye
Ajai
0
 
robsondeAuthor Commented:
dobby# ./mysql_install_db
./mysql_install_db[69]: my_print_defaults: not found
WARNING: The host 'dobby' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL deamon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
040803 16:03:00  /usr/local/libexec/mysqld: Shutdown Complete


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/usr/local/bin/mysqladmin -u root  password 'new-password'
/usr/local/bin/mysqladmin -u root -h dobby  password 'new-password'
See the manual for more instructions.

Please report any problems with the /usr/local/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

dobby#
0
 
robsondeAuthor Commented:
i think i have it working now.............


hang on a bit.......

0
 
ajaikumarrCommented:
Hai,

Wow... Great...

Bye
Ajai
0
 
robsondeAuthor Commented:


i got it working.....


next step is to make it atart automaticly with the system start????

0
 
ajaikumarrCommented:
Hai.

Good & Great... Yep
Something like this
6. Auto starting MYSQL
   Check /etc/rc.conf to make sure that the following line is at the bottom:
   local_rcconf="/etc/rc.conf.local"

   If /etc/rc.conf.local doesn't exist, create /etc/rc.conf.local and add:
   mysql=YES
   if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/safe_mysqld ]; then
      echo -n " mysqld"; /usr/local/bin/mysql start
   fi

Bye
Ajai
0
 
ajaikumarrCommented:
Hai,

Is it working?

Bye
Ajai
0
 
robsondeAuthor Commented:


it works!!

i had to put the start up stuff in to rc.local and not in rc.conf.local


other than that it all works.

thanks lots
0
 
ajaikumarrCommented:
Hai,

Good... Most welcome.

Bye
Ajai
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.