I have been fully transferred to Linux. In the past, some services and databases under windows had to be transferred step by step. Apache, tomcat, jboss, and so on are easy to handle, that is, mysql has been tossing for 2 or 3 days. It is mainly used to ensure that the default installation path is not used after simple configuration of copy (the Server is stored in the myServeres directory in the same way in windows ). As a result, the configuration file and permissions have been exhausted for a long time. Now, let's get down to the truth. First, describe my system
I have been fully transferred to Linux. In the past, some services and databases under windows had to be transferred step by step. Apache, tomcat, jboss, and so on are easy to handle, that is, mysql has been tossing for 2 or 3 days. It is mainly used to ensure that the default installation path is not used after simple configuration of copy (the Server is stored in the myServeres directory in the same way in windows ). As a result, the configuration file and permissions have been exhausted for a long time.
Now, let's get down to the truth. First, describe my system environment: Ubuntu8.04.1, and install build-essential 11.3, g ++ 4.2.3
Download mysql
Web: http://dev.mysql.com/downloads/mysql/5.1.html
I downloaded the 5.1 Linux (non RPM packages) package and the windows Without installer (unzip in C: \) package (the usage of this package is described below ).
2. Decompress mysql ~ /MyServeres/, change the directory name to mysql51 (in fact, wherever you put it, as long as you have the permission)
Decompress the Windows Without installer (unzip in C: \) package and copy the data directory to the mysql51 directory (this is very important)
3. Set the permissions of mysql51 and its subdirectories and files to ensure that you have the read and write permissions for mysql users.
4. Write the startup script mysql. sh. Modify the path of MYSQL_HOME as needed.
#! /Bin/bash
# Path to mySQL
MYSQL_HOME = "/home/james/myServeres/mysql51"
# Check for required environment variables.
If [-z "$ MYSQL_HOME"];
Then
Echo Error: MYSQL_HOME environment variable is not set.
Exit 2
Fi
# Paser command params
Case "$1" in
Start)
#/Var/run/mysqld. sock
If test-e $ MYSQL_HOME/mysqld. sock
# $ MYSQL_HOME/bin/mysqladmin ping -- socket = $ MYSQL_HOME/mysqld. sock> nul 2> & 1
Then
Echo MySQL already Start!
Else
Exec $ MYSQL_HOME/bin/mysqld -- no-defaults -- user = james -- basedir = $ MYSQL_HOME -- character-sets-dir = $ MYSQL_HOME/share/charsets -- language = $ MYSQL_HOME/share /english -- character-set-server = gb2312 -- socket = $ MYSQL_HOME/mysqld. sock
Fi
;;
Stop)
If test-e $ MYSQL_HOME/mysqld. sock
# $ MYSQL_HOME/bin/mysqladmin ping -- socket = $ MYSQL_HOME/mysqld. sock> nul 2> & 1
Then
Echo please input mysql user name:
Read name
Echo please input mysql password:
Read password
Exec $ MYSQL_HOME/bin/mysqladmin shutdown -- user = $ name -- password = $ password -- socket = $ MYSQL_HOME/mysqld. sock
Fi
;;
*)
Echo "Usage: mysql. sh {start | stop }"
;;
Esac
Exit 0
5. Save mysql. sh to the mysql51 directory and grant the execution permission.
6. mysql51 Directory:./mysql. sh start
7. OK. Enjoy your free installation of mysql database.