Centos6.x install and deploy MySQL5.5 detailed configuration
Not long after work, I couldn't hold on to a turbulent heart, 2333333
Summary of errors and solutions encountered during Database Installation
Objective: To build a lamp or lnmp architecture with centos6 and mysqld 5.5
First install the library file to be compiled:
Yum install gcc cpp glibc-devel gcc-c ++
Yum-y install gcc make libtool automake autoconf rrdtool-devel libpcap-devel gdbm-devel zlib-devel geoip-devel
Download mysql5.5: wgethttp: // mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.42-linux2.6-x86_64.tar.gz
Download to the directory and unzip: tar zxf mysql-5.5.42-linux2.6-x86_64.tar.gz-C/usr/local/src/
Create mysqld users and groups
/Usr/sbin/groupadd mysql
/Usr/sbin/useradd-g mysql
Go to the cd/usr/local/src/mysql-5.5 directory to start Compilation
Cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_DATADIR =/usr/local/mysql-5.5.42data \
-DMYSQL_UNIX_ADDR =/usr/local/mysql-5.5.42tmp/mysql. sock \
-DDEFAULT_CHARSET = gbk \
-DDEFAULT_COLLATION = gbk_chinese_ci \
-DENABLED_LOCAL_INFILE = ON \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_FEDERATED_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE = 1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE = 1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE = 1
Make
Make install
Grant mysqld + w directory permissions: chmod + w/usr/local
Change the directory owner and all master permissions: chown + R mysql: mysql/usr/local/mysql
Set the file soft connection: ln-s/usr/local/mysql/lib/libmysqlclient. so.16/usr/lib/libmysqlclient. so.16
Create a directory for mysql:
Mkdir-p/var/mysql/
Mkdir-p/var/mysql/data/
Mkdir-p/var/mysql/log
Change the directory owner permission: chown-R mysql: mysql/var/mysql/
Copy the configuration template in the directory: cd support-files/
Cpmy-large.cnf/var/mysql/my. cnf // copy different templates according to System Configuration
Cp mysql. server/etc/rc. d/init. d/mysqld // copy the Startup Script
Initialize Database
/Usr/local/mysql/scripts/mysql_install_db \
-- Defaults-file =/var/mysql/my. cnf \
-- Basedir =/usr/local/mysql \
-- Datadir =/var/mysql/data \
-- User = mysql
Set startup Service
Chmod + x/etc/init. d/mysqld
Vim/etc/init. d/mysqld (edit this file, find and modify the following variable content :)
Basedir =/usr/local/mysql
Datadir =/var/mysql/data
Add a startup Item:
Chkconfig -- add mysqld
Chkconfig -- level 345 mysqld on
Optimized execution path. library path:
[Root @ localhostmysql] # echo "exportPATH = $ PATH:/usr/local/mysql/bin/">/etc/profile
[Root @ localhostmysql] # source/etc/profile
[Root @ localhostmysql] # echo "/usr/local/mysql/lib/">/etc/ld. so. conf
[Root @ localhostmysql] # ldconfig -- refresh the library file search path to make the modification take effect
Start service: service mysqld restart
Set the Database root password: mysqladmin-uroot password nowpasswd
[Root @ xiangchen support-files] # mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 3
Server version: 5.5.42-log Source distribution
Copyright (c) 2000,201 4, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql>
Errors encountered during installation: During the copy of the system configuration file (my. cnf), you must copy different files for the system configuration; otherwise, mysql cannot be started!
Add, delete, and modify this post at any time
This article is from the "linux nest" blog, please be sure to keep this source http://xiangcc.blog.51cto.com/10201823/1650341