SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    RI
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql install, newbie questioni

    Hi
    I'm running through the Kevin Yank tutorial and installing mysql.. It is running, but the step to set it up to run automatically has me puzzled. The tutorial says to edit the script mysql.server and set the variable mysql_daemon_user=mysqlusr but the variable does not exist in the script. What am I missing from the tutorial directions?

    thanks for any help

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    (deleted)
    Last edited by 7stud; Jun 3, 2001 at 18:34.

  3. #3
    SitePoint Zealot oodie's Avatar
    Join Date
    Jul 2000
    Location
    Misty Mountain
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Strange... I can find it in my mysql.server, it's on line 18. Try to add the line then. This is the example of mine:
    Code:
    mysql_daemon_user=mysql   # Run mysqld as this user.

  4. #4
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Rocky Mountains
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing 'user' in 'mysql.server' script

    Originally posted by oodie
    Strange... I can find it in my mysql.server, it's on line 18. Try to add the line then. This is the example of mine:
    Code:
    mysql_daemon_user=mysql   # Run mysqld as this user.
    Hi...

    I have the same problem.

    Don't know 'exactly where' in the mysql.server file to place the line...
    mysql_daemon_user=mysql # Run mysqld as this user

    Could you please post a enough of the file... say 6-8 lines [ containing the line above ] so I/we can see precisely where the line should be located?

    Many Thanks in advance.

    Johnny

  5. #5
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    MySQL changed its installation procedure since the original version of my tutorial was published. Here's the relevant section of the second edition, which will be published on SitePoint for free and in a book version with several bonus chapters and reference appendices very soon.

    Installing MySQL Under Linux

    MySQL is freely available for Linux from http://www.mysql.com (or one of its mirrors listed at http://www.mysql.com/downloads/mirrors.html). Download the latest stable release (listed as recommended on the download page). You should grab the Tarball version under Source downloads, with filename mysql-3.xx.xx.tar.gz.
    With the program downloaded (it was about 10.5MB as of this writing), you should make sure you're logged in as root before proceeding with the installation, unless you only want to install MySQL in your own home directory. To begin, unpack the downloaded file and move into the directory that is created:
    Code:
    % tar xfz mysql-3.xx.xx.tar.gz
    % cd mysql-version
    Next, you need to configure the MySQL install. Unless you really know what you're doing, all you should have to do is tell it where to install. I recommend /usr/local/mysql:
    Code:
    % ./configure --prefix=/usr/local/mysql
    After sitting through the screens and screens of configuration tests, you'll eventually get back to a command prompt. Be sure the configuration completed successfully. If you see an error message just before the configuration quit, you'll need to address the problem it's complaining about. On Mandrake 8.0, for example, it complained of "No curses/termcap library found". I simply installed the libncurses5-devel package in Mandrake's Software Manager, and the configuration worked fine on a second attempt. Once configuration is complete, you're ready to compile MySQL:
    Code:
    % make
    After even more screens of compilation (this could take as long as a half an hour on some systems), you'll again be returned to the command prompt. You're now ready to install your newly compiled program:
    Code:
    % make install
    MySQL is now installed, but before it can do anything useful its database files need to be installed too. Still in the directory you installed from, type the following command:
    Code:
    % scripts/mysql_install_db
    With that done, you can delete the directory you've been working in, which just contains all the source files and temporary installation files. If you ever need to reinstall, you can simply re-extract the mysql-version.tar.gz file.

    With MySQL installed and ready to store information, all that's left is to get the server running on your computer. While you can run the server as the root user, or even as yourself (if, for example, you installed the server in your own home directory), the best idea is to set up on the system a special user whose sole purpose is to run the MySQL server. This will remove any possibility of someone using the MySQL server as a way to break into the rest of your system. To create a special MySQL user, you'll need to log in as root and type the following commands:
    Code:
    % /usr/sbin/groupadd mysqlgrp
    % /usr/sbin/useradd g mysqlgrp mysqlusr
    By default, MySQL stores all database information in the var subdirectory of the directory to which it was installed. We want to make it so that nobody can access that directory except our new MySQL user. Assuming you installed MySQL to the /usr/local/mysql directory, you can use these commands:
    Code:
    % cd /usr/local/mysql
    % chown R mysqlusr.mysqlgrp var
    % chmod R go-rwx var
    Now everything's set for you to launch the MySQL server for the first time. From the MySQL directory, type the following command:
    Code:
    % bin/safe_mysqld --user=mysqlusr &
    If you see the message 'mysql daemon ended', then the MySQL server was prevented from starting. The error message should have been written to a file called hostname.err (where hostname is your machine's hostname) in MySQL's var directory. You'll usually find that this happens because another MySQL server is already running on your computer.

    If the MySQL server was launched without complaint, the server will run (just like your Web or FTP server) until your computer is shut down. To test that the server is running properly, type the following command:
    Code:
    % bin/mysqladmin -u root status
    A little blurb with some statistics about the MySQL server should be displayed. If you receive an error message, something has gone wrong. Again, check the hostname.err file to see if the MySQL server output an error message while starting up. If you retrace your steps to make sure you followed the process described above, and this doesn't solve the problem, a post to the SitePoint.com Forums will help you pin it down in no time.

    If you want your MySQL server to run automatically whenever the system is running (just like your Web server probably does), you'll have to set it up to do so. In the share/mysql subdirectory of the MySQL directory, you'll find a script called mysql.server that can be added to your system startup routines to do this.

    First of all, assuming you've set up a special MySQL user to run the MySQL server, you'll need to tell the MySQL server to start as that user by default. To do this, create in your system's /etc directory a file called my.cnf that contains these two lines:
    Code:
    [mysqld]
    user=mysqlusr
    Now, when you run safe_mysqld or mysql.server to start the MySQL server, it will launch as mysqlusr without your having to tell it to. All thats left to do is to set up your system to run mysql.server automatically at startup.

    Setting up your system to run the script at startup is a highly operating system-dependant task. If you're not sure of how to do this, you'd be best to ask someone who knows. However the following commands (starting in the MySQL directory) will do the trick for most versions of Linux:
    Code:
    % cp share/mysql/mysql.server /etc/rc.d/init.d/
    % cd /etc/rc.d/init.d
    % chmod 500 mysql.server
    % cd /etc/rc.d/rc3.d
    % ln s ../init.d/mysql.server S99mysql
    % cd /etc/rc.d/rc5.d
    % ln s ../init.d/mysql.server S99mysql
    That's it! To test that this works, reboot your system and request the status of the server as before.

    One final thing you might like to do for convenience's sake is to place the MySQL client programs, which you'll use to administer your MySQL server later on, in the system path. To this end, you can place symbolic links to mysql, mysqladmin, and mysqldump in your /usr/local/bin directory:
    Code:
    % ln s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
    % ln s /usr/local/mysql/bin/mysqladmin /usr/local/bin/mysqladmin
    % ln s /usr/local/mysql/bin/mysqldump /usr/local/bin/mysqldump

    The Post-Installation Setup Tasks section still applies as before.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Babys got backa hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •