Solved

installing mysql on openBSD, how??

Posted on 2004-08-02
37
1,046 Views
Last Modified: 2008-03-10
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??

0
Comment
Question by:robsonde
  • 21
  • 16
37 Comments
 
LVL 11

Accepted Solution

by:
ajaikumarr earned 125 total points
ID: 11700707
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
 
LVL 2

Author Comment

by:robsonde
ID: 11701947
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702036
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702050
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
 
LVL 2

Author Comment

by:robsonde
ID: 11702076

as far as i can see mysql is not running.

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

0
 
LVL 2

Author Comment

by:robsonde
ID: 11702089
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702091
Hai,

Sorry...

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

0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702110
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702142
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
 
LVL 2

Author Comment

by:robsonde
ID: 11702172
no i cant find mysql.sock or mysqld.sock in any of those locations.

0
 
LVL 2

Author Comment

by:robsonde
ID: 11702223
i am  not finding my.conf anywhere sorry.

0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702238
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702266
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
 
LVL 2

Author Comment

by:robsonde
ID: 11702320
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702348
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
 
LVL 2

Author Comment

by:robsonde
ID: 11702393
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702403
Hai,

Great...

Now try step 4 & 5.

Bye
Ajai
0
 
LVL 2

Author Comment

by:robsonde
ID: 11702450

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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702457
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
 
LVL 2

Author Comment

by:robsonde
ID: 11702484


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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702506
Hai,

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

Bye
Ajai
0
 
LVL 2

Author Comment

by:robsonde
ID: 11702579
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702617
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702636
Hai,

Most prob. mysqld will be on /bin directory.

Bye
Ajai
0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702662
Hai,

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

Bye
Ajai
0
 
LVL 2

Author Comment

by:robsonde
ID: 11702759
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702785
Hai,

Try the 2nd and 3rd steps.

Bye
Ajai
0
 
LVL 2

Author Comment

by:robsonde
ID: 11702795
mysql version 3.23.55

0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702796
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
 
LVL 2

Author Comment

by:robsonde
ID: 11702841
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
 
LVL 2

Author Comment

by:robsonde
ID: 11702898
i think i have it working now.............


hang on a bit.......

0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702918
Hai,

Wow... Great...

Bye
Ajai
0
 
LVL 2

Author Comment

by:robsonde
ID: 11702925


i got it working.....


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

0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11702951
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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11703431
Hai,

Is it working?

Bye
Ajai
0
 
LVL 2

Author Comment

by:robsonde
ID: 11703634


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
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 11703761
Hai,

Good... Most welcome.

Bye
Ajai
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now