Environment: Oracle Linux 6 (64 bit)
Download mysql: http://dev.mysql.com/downloads/mysql/5.1.html version: 5.5.36 platform: Source Code
Generic Linux (Architecture Independent), Compressed TAR archive(mysql-5.36.tar.gz) to download this package of ipv7m
Next, use cmake to install mysql. Before installation, make sure that cmake: rpm-qa | grep cmake is installed and uninstall the old version of mysql.
Extract
tar -xzvf mysql-5.5.36.tar.gz
Create installation directory
Cd/u02mkdir mysqlmkdir mysql/datachmod-R 755 mysql-5.5.36chmod-R 755 mysql compilation and installation mysql 5.5.36
cd /u02/mysql-5.5.36cmake -DCMAKE_INSTALL_PREFIX=/u02/mysql && make && make install
scripts/mysql_install_db \
--basedir=/u02/mysql \
--datadir=/u02/mysql/data \
--user=grid
Other parameters for cmake:
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_DATADIR=/var/mysql/data
Modify configuration file
Cp support-files/my-medium.cnf/u02/mysql/my. cnfchown-R grid: grid/u02/mysqlvi/u02/mysql/my. cnf // Add the following content
[Mysqld] basedir =/u02/mysql datadir =/u02/mysql/data log-error =/u02/mysql/mysql_error.log pid-file =/u02/mysql. pid user = grid tmpdir =/tmp start mysql
Bin/mysqld_safe -- user = grid & add mysql to startup
Cd/u02/mysql/support-filescp. /mysql. server/etc/init. d/mysqld/etc/init. d/mysqld startchmod + x/etc/init. d/mysqldvi/etc/init. d/mysqld (edit this file, find and modify the following variable content :)
Basedir =/usr/local/mysql datadir =/var/mysql/data check whether the service has been added to linux
Chkconfig -- list mysqldchkconfig -- add mysqldchkconfig -- level 345 mysqld on
Vi/etc/profileexport PATH = $ PATH:/u02/mysql/binsource/etc/profile start the mysql Service
Service mysqld start mysql
Cd/u02/mysql/bin./mysql-uroot set the mysql password in shell
mysqladmin -u root password 123456
Log on to mysql
Syntax:
Mysql [-u username] [-h host] [-p [password] [dbname] display Database
Mysql> show databases; open the database
Mysql> use mysql; View tables
Mysql> show tables; database creation:
Create database name;