Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Need Help With MySQL Compilation And Install
Divya
post Feb 7 2006, 03:58 PM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 16
Joined: 26-December 05
Member No.: 10,298



I`m new in all this computer thing, so please help me! And i`m also not very good at html and so on. I decided to try MySQL. There are instruction for it, but i don`t fully understand how to do this all. Of course, i understand how to do it, but i`d like that somebody help me, because i really want to know if i`m doing smth wrong.

QUOTE
We will compile and install MySQL software in the /usr/local/mysql directory:
./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --with-unix-socket-path=/tmp/mysql.sock --with-mysqld-ldflags=-all-static
make
su
make install
strip /usr/local/mysql/libexec/mysqld
scripts/mysql_install_db
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql


In general, the process of installing the server is almost identical to the one described in the MySQL manual. The only change is the use of a few additional parameters, specified in the ./configure line. The most important difference is the use of --with-mysqld-ldflags=-all-static parameter, which causes the MySQL server to be linked statically. This will significantly simplify the process of chrooting the server, as described in Section 3. With regard to the other parameters, they instruct the make program to install the software in the /usr/local/mysql directory, run the MySQL daemon with the privileges of the mysql account, and create the mysql.sock socket in the /tmp directory.

2.2 Copy configuration file
After executing the above commands, we must copy the default configuration file in accordance with the expected size of the database (small, medium, large, huge). For example:
cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf


2.3 Start the server
At this point MySQL is fully installed and ready to run. We can start the MySQL server by executing the following command:
/usr/local/mysql/bin/mysqld_safe &


2.4 Test the connection
Try to establish a connection with the database as follows:

/usr/local/mysql/bin/mysql -u root mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.13-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+----------+
| Database |
+----------+
| mysql    |
| test    |
+----------+
2 rows in set (0.00 sec)

mysql> quit;
Once the connection is successfully established, we can shutdown the database:

/usr/local/mysql/bin/mysqladmin -u root shutdown


and start securing the software. Otherwise, we should analyze the information stored in the /usr/local/mysql/var/`hostname`.err log file, and eliminate the cause of any problems.

3. Chrooting the server
The first step of securing MySQL is to prepare the chrooted environment, in which the MySQL server will run. The chrooting technique was described in detail in the first article of this series ("Securing Apache: Step-by-Step"), so if you are not familiar with the technique or why chrooting is recommended, please refer to that article.
3.1 Operating system
Like in the previous articles, the target operating system is FreeBSD 4.7. However, the methods presented should also apply on most modern UNIX and UNIX-like systems.
3.2 Prepare chroot environment
In order to prepare the chrooted environment, we must create the following directory structure:
mkdir -p /chroot/mysql/dev
mkdir -p /chroot/mysql/etc
mkdir -p /chroot/mysql/tmp
mkdir -p /chroot/mysql/var/tmp
mkdir -p /chroot/mysql/usr/local/mysql/libexec
mkdir -p /chroot/mysql/usr/local/mysql/share/mysql/english


3.3 Set access rights
The access rights to the above directories should be set as follows:
chown -R root:sys /chroot/mysql
chmod -R 755 /chroot/mysql
chmod 1777 /chroot/mysql/tmp


3.4 Create directory structure
Next, the following files have to be copied into the new directory structure:
cp /usr/local/mysql/libexec/mysqld /chroot/mysql/usr/local/mysql/libexec/
cp /usr/local/mysql/share/mysql/english/errmsg.sys /chroot/mysql/usr/local/mysql/share/mysql/english/
cp /etc/hosts /chroot/mysql/etc/
cp /etc/host.conf /chroot/mysql/etc/
cp /etc/resolv.conf /chroot/mysql/etc/
cp /etc/group /chroot/mysql/etc/
cp /etc/master.passwd /chroot/mysql/etc/passwords
cp /etc/my.cnf /chroot/mysql/etc/


Actually the thing i don`t fully understand is "Test the connection
Try to establish a connection with the database as follows". There is always an error, something is wrong i don`t know what to do. I`m checking and checking if i`m doing something wrong but i still can`t do this part, so i can`t move on.... sad.gif Please, i reallyhope that you`ll give my a tip! smile.gif

This post has been edited by miCRoSCoPiC^eaRthLinG: Feb 7 2006, 05:55 PM
Go to the top of the page
 
+Quote Post
Jeigh
post Feb 7 2006, 04:42 PM
Post #2


Whitest Black Mage
Group Icon

Group: [MODERATOR]
Posts: 1,371
Joined: 20-May 05
From: NB, Canada
Member No.: 5,281
myCENTs:65.99



I had some trouble setting up mysql back when I did it too, if I remember correctly the errors started in the same general stage of progress too. Can you post the actual error message you are receiving?
Go to the top of the page
 
+Quote Post
abhiram
post Feb 7 2006, 04:51 PM
Post #3


Hedonist at large
Group Icon

Group: Members
Posts: 610
Joined: 30-July 05
From: another realm
Member No.: 7,524



Well, after installing mysql, try typing the following in a terminal as a regular user (not root):

CODE
mysql -u root -p


and it should prompt you for the password at which you just press 'enter' since, you haven't set the password yet (you better set it if you are gonna make your system accessible to the internet. If it's just for learning's sake, it's not really required).

If you're getting an error, that means the mysql service hasn't been started. To start it, what I use is:

CODE
/etc/init.d/mysql start


which is to be typed as root. In many distros, the scripts are in /etc/init.d, but it might be in other places also like /etc/rc.d.

Once the service starts successfully, try connecting to it again using the first bit of code I've shown above.

Hope this helps.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. MySQL - Trouble With Bulk Insert Statements(3)
  2. MySQL Realtime Replication(4)
  3. Recover Tables From A MySQL .frm File(8)
  4. Mirror My MySQL Database To Another Mysql Server(4)
  5. How To Connect MySQL With Flash?(8)
  6. MySQL Output Database Question(18)
  7. MySQL, Multiple Tables(24)
  8. Navcat For MySQL(9)
  9. Permission Problem With Mysql Database Creation(8)
  10. Oracle 10g Install Issues(27)
  11. Mysql And Php(15)
  12. Login System Using A Mysql Db(5)
  13. Oracle Vs. Mysql Vs. Postgresql(9)
  14. Subqueries In Mysql(1)
  15. Apache Php With Mysql On Windows [solved](9)
  1. Mysql - So Hard(14)
  2. Mysql Problem(1)
  3. Sun Bought Mysql(6)
  4. Mysql Backup With Another Address?(4)
  5. I Have An Error With My Mysql Connection(7)
  6. Mysql And User File_priv(0)
  7. Mysql Database Management(1)
  8. Mysql Database Entry By Excel Sheets(2)
  9. Mysql On Computer(9)
  10. Any Website Provide Free Host Mysql Host?(4)
  11. Mysql Multiple Tables(1)
  12. Mysql Overhead(3)
  13. Login System(6)


 



- Lo-Fi Version Time is now: 5th December 2008 - 01:21 AM