Wednesday, 8 August 2012

How to install MySQL in Puppy LINUX

Posted by Gary Newell  |  at  22:42 7 comments

Introduction

This is part 3 in the series of how to install the LAMP stack (LINUX, Apache, PHP, MySQL) within Puppy LINUX.

If you have missed the first two posts they are available here:

Setup

I am using Lucid Puppy 5.2.8 as this gives full access to the Ubuntu repositories which makes it much easier to achieve the end goal which is a portable device able to run a web server as a development environment.

Installing MySQL

This was quite a tricky install and took some effort to get working.

1. Click the install icon (top row of icons)
2. Click the configure package manager button

3. Select the 3 Ubuntu repositories at the bottom and click ok.
4. Close the package manager and restart it by clicking install again.

5. Type MySQL in the search box
6. Select the server metapackage

7. Download and install all the packages that appear

8. When the packages have installed run the installer again and search for libmysql
9. Install the libmysqlclient library
10. Open a console window
11. Create a folder called /var/lib/mysql
12. Create a user called mysql by typing "adduser mysql"
13. Change the owner of the /var/lib/mysql folders to mysql by typing "chown -R mysql /var/lib/mysql"
14. Change the group of the /var/lib/mysql folders to mysql by typing "chgrp -R mysql /var/lib/mysql"
15. Type "mysql_install_db"
16. Type "mysqld" to start the server running.
17. Open another console and type "mysql -u root"
18. Typing exit will exit MySQL
19. Type mysql_upgrade to upgrade the MySQL

Summary

At this point MySQL will be installed and running. I hope these instructions work for you but if not feel free to leave a comment because I have fallen down many pitfalls to get the instructions to this stage.

You can obviously get mysqld to run at boot time so that it is available as soon as you need it.






7 comments:

  1. very good, tks

    ReplyDelete
  2. First of all, thank you very much for putting together these pages for installing Apache, PHP, and MySQL to Puppy. I am still learning Linux, and without these pages, a process that would have probably taken me weeks or months has been compressed down to a couple days.

    I do still have some problems installing MySQL that neither these instructions nor some Google searches have managed to resolve. Everything goes according to your instructions until 12 ‘adduser mysql.’ I get the following error after entering this command:

    Error from command ‘adduser mysql’:

    passwd: pam_start() failed, error 26

    Is this part of the normal installation procedure, or should it prompt me to create a password like in the Apache installation?

    The next error comes at 16 ‘mysqld.’ I do not know if this ties into the above problem or if it is independent, as instructions 13-15 produced no errors.

    Error from command ‘mysqld’:

    120831 13:44:18 [Note] Plugin 'FEDERATED' is disabled.
    InnoDB: The first specified data file ./ibdata1 did not exist:
    InnoDB: a new database to be created!
    120831 13:44:18 InnoDB: Setting file ./ibdata1 size to 10 MB
    InnoDB: Database physically writes the file full: wait...
    120831 13:44:20 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile0 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    120831 13:44:21 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile1 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    InnoDB: Doublewrite buffer not found: creating new
    InnoDB: Doublewrite buffer created
    InnoDB: Creating foreign key constraint system tables
    InnoDB: Foreign key constraint system tables created
    120831 13:44:21 InnoDB: Started; log sequence number 0 0
    120831 13:44:21 [ERROR] Can't start server : Bind on unix socket: No such file or directory
    120831 13:44:21 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
    120831 13:44:21 [ERROR] Aborting

    120831 13:44:21 InnoDB: Starting shutdown...
    120831 13:44:23 InnoDB: Shutdown completed; log sequence number 0 44233
    120831 13:44:23 [Note] mysqld: Shutdown complete


    Lastly, I get the following error from 17, ‘mysql -u root’.

    Error from command ‘mysql -u root’:

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)




    Once again, I thank you for taking the time to create these pages. I would greatly appreciate any advice you can provide on these problems with installing MySQL.

    ReplyDelete
  3. Actually, I figured it out. Kinda. As in a google search led me to something that has resolved the issue, I don't actually understand the underlying mechanisms. Yet.

    From a post on http://www.linuxforums.org/forum/servers/1451-what-mysql-sock-file.html, I got:

    Delete the log files ib_logfile0, ib_logfile1 and ibdata1 in the /var/lib/mysql directory and then type:

    "mysqld_safe --user=mysql &"

    As I had not created any databases yet, I did not risk losing data. But I can now run MySQL!

    Once again, thank you for creating these pages!

    ReplyDelete
  4. I had the same issues and errors as anonymous above, and the fix suggested worked for me as well.

    ReplyDelete
  5. Everything work flawlessly (with comments of Anonymous). I've got question, what insert to php.ini to be able to use MySQL from PHP?
    Michal

    ReplyDelete
  6. Hey , thanks people!
    Had the same problem as Anonymous and his idea fixed it!
    Puppy 528.

    ReplyDelete
  7. On Tahr I also had to creaate /var/lib/mysql-files

    ReplyDelete

Feel free to comment on any of the blog posts. Please try to be constructive.

Offensive messages will be removed as will blatant adverts for misleading products and sites.

Thanks for visiting my blog

    Popular Posts



back to top