Install Mysql-5.5.9 in Linux environment (40) _ MySQL

Source: Internet
Author: User
Installing Mysql-5.5.9 in Linux (40) creating users and user groups
Groupadd mysql
Useradd-g mysql

Download:
Bison-2.5.tar.gz
Cmake-2.8.4.tar.gz
M4-1.4.9.tar.gz
Make-3.82.tar.gz
Mysql-5.5.9.tar.gz
Ncurses-devel-5.7-3.20090208.el6.i686.rpm

Decompress:
Tar-zxvf bison-2.5.tar.gz
Cd bison-2.5
./Configure
Make
Make install

Tar-zxvf cmake-2.8.4.tar.gz
Cd cmake-2.8.4
./Configure
Make
Make install


Tar-zxvf m4-1.4.9.tar.gz
Cd m4-1.4.9
./Configure
Make
Make install

Tar-zxvf make-3.82.tar.gz
Cd make-3.82
./Configure
Make
Make install

Tar-zxvf mysql-5.5.9.tar.gz
Go to the mysql Directory:
Cd mysql-5.5.9
Run:
Cmake ./
-DCMAKE_INSTALL_PREFIX =/usr/local/xiaorui/mysql/mysql-5.5.9/
-DMYSQL_DATADIR =/usr/local/mysql/data/
-DMYSQL_UNIX_ADDR =/usr/local/mysql/data/mysqld. sock/
-DDEFAULT_CHARSET = utf8/
-DDEFAULT_COLLATION = utf8_general_ci/
-DEXTRA_CHARSETS = all/
-DENABLED_LOCAL_INFILE = 1
Note: If/tmp/mysqld. sock exists, cp to/usr/local/mysql/data.

If no error is reported, make & make install ):
CMake Error at cmake/readline. cmake: 82 (MESSAGE ):
Curses library not found. Please install appropriate package,
Remove CMakeCache.txt and rerun cmake. On Debian/Ubuntu, package name is libncurses5-dev, on RedHat and derivates it is ncurses-devel.
Call Stack (most recent call first ):
Cmake/readline. cmake: 126 (FIND_CURSES)
Cmake/readline. cmake: 216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt: 256 (MYSQL_CHECK_READLINE)
-- Initializing ing incomplete, errors occurred

Installation:
Rpm-ivh ncurses-devel-5.7-3.20090208.el6.i686.rpm
Rm-f CMakeCache.txt
Cmake ./
-DCMAKE_INSTALL_PREFIX =/usr/local/xiaorui/mysql/mysql-5.5.9/
-DMYSQL_DATADIR =/usr/local/mysql/data/
-DMYSQL_UNIX_ADDR =/usr/local/mysql/data/mysqld. sock/
-DDEFAULT_CHARSET = utf8/
-DDEFAULT_COLLATION = utf8_general_ci/
-DEXTRA_CHARSETS = all/
-DENABLED_LOCAL_INFILE = 1

Make

Make install

Cd mysql-5.5.9
Cp support-files/my-huge.cnf/etc/my. cnf

Add permissions:
Chown mysql: mysql/etc/my. cnf
Chown-R mysql: mysql/usr/local/mysql/data
Chown-R mysql: mysql/usr/local/xiaorui/mysql/mysql-5.5.9.
Chown-R mysql: mysql/usr/local/

Switch users:
Su mysql
Go to the mysql Directory
Cd mysql-5.5.9/scripts
Initialize mysql:
Add execution permission:
Chmod a + x mysql_install_db
Run:
./Mysql_install_db -- user = mysql -- basedir =/usr/local/xiaorui/mysql/mysql-5.5.9 -- ldata =/usr/local/mysql/data &

Enable:
Cd mysql-5.5.9/bin
Run:
./Mysqld_safe -- user = mysql -- datadir =/usr/local/mysql/data /&

Check whether enabled:
Ps-ef | grep mysql
If there is information:
Root 26502 26379 1 00:00:00 pts/2/bin/sh./mysqld_safe -- user = mysql -- datadir =/usr/local/mysql/data/
Mysql 26766 26502 5 00:00:00 pts/2/usr/local/xiaorui/mysql/mysql-5.5.9/bin/mysqld -- basedir =/usr/local/xiaorui/mysql/mysql-5.5.9 -- datadir =/ usr/local/mysql/data/-- plugin-dir =/usr/local/xiaorui/mysql/mysql-5.5.9/lib/plugin -- user = mysql -- log-error =/usr/local /mysql/data // hadoop2.err -- pid-file =/usr/local/mysql/data // hadoop2.pid -- socket =/tmp/mysql. sock -- ports = 3306
View:
-- Socket =/tmp/mysql. sock
Check whether the mysql. sock file exists in the tmp directory.
If yes, it will be normal.
If not, kill the process and re-execute mysql initialization:
Kill-9 26502
Kill-9 26766
Reinitialize mysql:
Cd mysql-5.5.9/scripts
./Mysql_install_db -- user = mysql -- basedir =/usr/local/xiaorui/mysql/mysql-5.5.9 -- ldata =/usr/local/mysql/data &


Configure environment variables:
Cd $ HOME
Vim. bash_profile
Add:
Export MYSQL_HOME =/usr/local/xiaorui/mysql/mysql-5.5.9.
PATH = $ MYSQL_HOME/bin: $ PATH
Export PATH

Use mysql;

Go to mysql:
./Mysql-uroot-p
Initialize the root password:
Update user set password = PASSWORD ('000000') where User = 'root ';
Mysqladmin-u root password 'mysql321'
Mysqladmin-u root-h hadoop1 password 'mysql321'
Mysqladmin-u root-h localhost password 'mysql321'
Mysql-u root -- password = 'mysql321'

Create database hivedb;
Grant all privileges on hivedb. * TO 'hiveusr' @ '%' identified by 'hiveusr321 'with grant option;
Grant all privileges on hivedb. * TO 'hiveusr' @ 'localhost' identified by 'hiveusr321' with grant option;
Grant all privileges on hivedb. * TO 'hiveusr' @ 'hadoop1 'identified BY 'hiveusr321 'with grant option;
Flush privileges;

Note:
Hivedb: hive MetaBase
Hiveusr: database user

If mysql. sock is in another location:
Create link:
Ln-s/var/lib/mysql. sock/tmp/mysql. sock

Protect the mysql. sock file:
Chmod + t/tmp/mysql. sock

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.