MySQL Installation and tuning

Source: Internet
Author: User
Tags chmod install openssl


MySQL installation method:

1.yum Installation

2.RPM Installation

3. General installation./configure make Makeinstall

4. Source code CMake way to compile and install


Required Packages:

Mysql-5.5.32.tar.gz

Cmake-2.8.8.tar.gz

The package must be selected correctly


System:

[Email protected] ~]# cat/etc/redhat-release

CentOS Release 6.5 (Final)

[Email protected] ~]# uname-a

Linux qbpc 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 03:15:09 UTC x86_64 x86_64 x86_64 gnu/linux

I also installed in the 6.8 system succeeded, should the 6.x series should be similar


Get ready:

[Email protected] ~]# Cat/etc/udev/rules.d/70-persistent-net.rules

[Email protected] ~]#>/etc/udev/rules.d/70-persistent-net.rules


1.3 Installing related Packages

1.3.1cmake Software

#cd/home/tools/

#tar XF cmake-2.8.8.tar.gz

#cd cmake-2.8.8

#./configure


------------------------------------------------------------------------------------------

Here can meet the question 1:

---------------------------------------------

CMake 3.1.1, Copyright 2000-2015 Kitware, Inc.

C compiler on the This system IS:CC

---------------------------------------------

Error when bootstrapping CMake:

Cannot find appropriate C + + compiler on the This system.

Please specify one using environment variable CXX.

See Cmake_bootstrap.log for compilers attempted.

Solve:

Yum install make CMake gcc gcc-c++-y

------------------------------------------------------------------------------------------


Gmake

Gmake Install

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/95/36/wKioL1kSzjDwT3dTAAB2r73pSQw058.jpg-wh_500x0-wm_ 3-wmp_4-s_2780340018.jpg "style=" Float:none; "title=" 1.jpg "alt=" Wkiol1kszjdwt3dtaab2r73psqw058.jpg-wh_50 "/>

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/95/36/wKioL1kSzjGT7CjbAAA2DBnwhgI700.jpg-wh_500x0-wm_ 3-wmp_4-s_2432545825.jpg "style=" Float:none; "title=" 2.jpg "alt=" Wkiol1kszjgt7cjbaaa2dbnwhgi700.jpg-wh_50 "/>

Cd..


1.3.2 Dependency Packages

[Email protected] tools]# yum-y install Ncurses-devel


There will be a problem with not installing:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/95/39/wKioL1kS3--CxEokAABwAs4Ikog195.jpg-wh_500x0-wm_ 3-wmp_4-s_751358728.jpg "title=" 8.jpg "alt=" Wkiol1ks3--cxeokaabwas4ikog195.jpg-wh_50 "/>

1.4 Starting MySQL Installation

1.4.1 Creating users and Groups

[[email protected] tools]# Groupadd MySQL

[[email protected] tools]# useradd mysql-s/sbin/nologin-m-G MySQL

1.4.2 Decompression compiled MySQL

[Email protected] tools]# Tar XF mysql-5.5.32.tar.gz

[Email protected] tools]# CD mysql-5.5.32

[[email protected] mysql-5.5.32] #cmake. -dcmake_install_prefix=/application/mysql-5.5.32 \ Installation Path

-dmysql_datadir=/application/mysql-5.5.32/data \ Data File path

-dmysql_unix_addr=/application/mysql-5.5.32/tmp/mysql.sock \ Sock Path

-ddefault_charset=utf8 \ m Default Character set

-DDEFAULT_COLLATION=UTF8_GENERAL_CI \ Default Character Set proofing rules

-DEXTRA_CHARSETS=GBK,GB2312,UTF8,ASCII \

-denabled_local_infile=on \

-dwith_innobase_storage_engine=1 \

-dwith_federated_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwithout_example_storage_engine=1 \

-dwithout_partition_storage_engine=1 \

-dwith_fast_mutexes=1 \

-dwith_zlib=bundled \

-denabled_local_infile=1 \

-dwith_readline=1 \

-dwith_embedded_server=1 \

-dwith_debug=0


650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/95/36/wKioL1kSzvOTRq39AAA1fVAfuKM187.jpg-wh_500x0-wm_ 3-wmp_4-s_4093936295.jpg "title=" 3.jpg "alt=" Wkiol1kszvotrq39aaa1fvafukm187.jpg-wh_50 "/>

[[email protected] mysql-5.5.32]# make && make install

Longer time


------------------------------------------------------------------------------------------

May meet problem 2

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/95/37/wKiom1kSz5qxDYk3AAAi92Q85eU109.jpg-wh_500x0-wm_ 3-wmp_4-s_195262268.jpg "title=" 5.jpg "alt=" Wkiom1ksz5qxdyk3aaai92q85eu109.jpg-wh_50 "/>

Solve

[email protected] mysql-5.5.32]# which cmake

/usr/local/bin/cmake

Check

CMake installation is not correct, re-install

------------------------------------------------------------------------------------------

Compile complete

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/95/36/wKiom1kSz1vjAdtqAABlVFcRKTY350.jpg-wh_500x0-wm_ 3-wmp_4-s_2168045282.jpg "title=" 4.jpg "alt=" Wkiom1ksz1vjadtqaablvfcrkty350.jpg-wh_50 "/>


[Email protected] mysql-5.5.32]# ln-s/application/mysql-5.5.32//application/mysql


The installation of this cmake is even successful!


1.4.3 Initializing the configuration of MySQL

1. View the default template configuration file

2. Select the configuration file

[email protected] tools]# CP mysql-5.5.32/support-files/my-small.cnf/etc/my.cnf

Cp:overwrite '/etc/my.cnf '? Y

If the test environment is small, the production environment can be selected according to the hardware, for example my-innodb-heavy-4g.cnf

3. Configure Environment variables

[Email protected] tools]# echo ' export path=/application/mysql/bin: $PATH ' >>/etc/profile

Must be placed in front of path, because there may be a yum installed client later, if not put in front, if you use the MySQL command, the system's RPM command will be called.

[Email protected] tools]# Tail/etc/profile

Fi

Done


unset I

Unset-f Pathmunge

Export JAVA_HOME=/APPLICATION/JDK

Export classpath= $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib

Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH: $HOME/bin

Export Resin_home=/application/resin

Export Path=/application/mysql/bin: $PATH

[Email protected] tools]# Source/etc/profile

[Email protected] tools]# echo $PATH

/application/mysql/bin:/application/jdk/bin:/...


Problem with environment variable error 3:

http://oldboy.blog.51cto.com/2561410/1122867


4. Initialize the data file (error-prone steps)

[Email protected] tools]# chown-r mysql.mysql/application/mysql/data/

[Email protected] tools]# chmod-r 1777/tmp/

[Email protected] tools]# cd/application/mysql/scripts/

[Email protected] scripts]#/mysql_install_db--basedir=/application/mysql/--datadir=/application/mysql/data/-- User=mysql

The following two OK is the successful initialization

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/95/38/wKiom1kS1nXiURLnAAAa0ZR6cvk848.jpg-wh_500x0-wm_ 3-wmp_4-s_3703733753.jpg "title=" 6.jpg "alt=" Wkiom1ks1nxiurlnaaaa0zr6cvk848.jpg-wh_50 "/>

Tips:

warning: the host  ' QBPC '  could not be looked up with  Resolveip. this probably means that your libc libraries are not 100 %  compatiblewith this binary MySQL version. The MySQL daemon,  mysqld, should worknormally with the exception that host name  Resolving will not work. this means that you should use ip addresses instead of  hostnameswhen specifying mysql privileges ! Installing mysql system tables ... Okfilling help tables ... okto start mysqld at boot time you have to copysupport-files/ Mysql.server to the right place for your system Startup script Please remember  to set a password for the mysql root user ! to do so, start the server, then issue the following  commands:/application/mysql//bin/mysqladmin -u root password  ' New-password '/application/ mysql//bin/mysqladmin -u root -h qbpc password  ' New-password ' Change password alternatively  you can run:/application/mysql//bin/mysql_secure_installationwhich will also  Give you the option of removing the testdatabases and anonymous  user created by default.  This isstrongly recommended for  Production servers. See the manual for more instructions. Starting You can start the mysql  daemon with:cd /application/mysql/ ; /application/mysql//bin/mysqld_safe & Test You can test the mysql daemon with mysql-test-run.plcd /application/mysql//mysql-test ; perl mysql-test-run.pl Report bugplease report  any problems with the /application/mysql//scripts/mysqlbug script!

For the warning of the first sentence, the solution

[Email protected] scripts]# vim/etc/hosts

127.0.0.1 localhost qbpc---plus host name


When a variety of normal, in MySQL or mysql-uroot-pqinbin123 can not be carried out, it is necessary to think about whether the initialization of the file is correct!


5. Set the normal way to start and close scripts

[Email protected] mysql]# cd/home/tools/mysql-5.5.32

[Email protected] mysql-5.5.32]#/BIN/CP support-files/mysql.server/etc/init.d/mysqld

[Email protected] mysql-5.5.32]#/etc/init.d/m

Mdmonitor MULTIPATHD

When the tab does not come out, indicate that there is a problem, add permission

[Email protected] mysql-5.5.32]# chmod +x/etc/init.d/mysqld

[[email protected] mysql-5.5.32]#/etc/init.d/mysqld start

Starting MySQL ... [OK]

[Email protected] mysql-5.5.32]# Netstat-ntlup | grep 3306

TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 28628/mysqld

It worked!

[Email protected] mysql-5.5.32]# chkconfig mysqld on

[Email protected] mysql-5.5.32]# chkconfig--list mysqld

Mysqld 0:off1:off2:on3:on4:on5:on6:off


6. Log in to MySQL troubleshooting

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/95/38/wKioL1kS2-rAmV4wAAAd9teXY4w682.jpg-wh_500x0-wm_ 3-wmp_4-s_737883791.jpg "title=" 7.jpg "alt=" Wkiol1ks2-ramv4waaad9texy4w682.jpg-wh_50 "/>

Mysql-uroot-p123: Do the following when you are not logged in

Pkill mysqld

Lsof-i: 3306

rm-rf/application/mysql/data/*

Then repeat 4. Initialize the data file (error-prone steps)


7. Successful Login

First optimization, safety, cask principles

[[email protected] mysql-5.5.32]# mysqlwelcome to the mysql monitor.   Commands end with ; or \g.Your MySQL connection id is  2server version: 5.5.32 source distributioncopyright  (c)  2000, 2013,  Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or  Itsaffiliates. other names may be trademarks of their respectiveowners . type  ' help; '  or  ' \h '  for help. Type  ' \c '  to clear the current input  statement.mysql> select user,host from mysql.user;+------+-----------+| user  | host      |+------+-----------+| root | 127.0.0.1  | |  root | :: 1       | |       | localhost | |  root | localhost | |       | qbpc      | |  root | qbpc      |+------+-----------+6 rows in  set  (0.00 sec) mysql> delete from mysql.user where user= ""; query ok, 2 rows affected  (0.00 sec) mysql> select user,host  from mysql.user;+------+-----------+| user | host      |+--- ---+-----------+| root | 127.0.0.1 | |  root | ::1       | |  root | localhost | |  root | qbpc      |+------+-----------+4 rows in  set  (0.00 sec) mysql> delete from mysql.uSer where host= "QBPC"; query ok, 1 row affected  (0.00 sec) mysql> delete from  Mysql.user where host= ":: 1"; query ok, 1 row affected  (0.00 sec) mysql> drop database test; query ok, 0 rows affected  (0.00 sec) mysql> show databases;+-------- ------------+| database           |+-------------- ------+| information_schema | |  mysql              | |  performance_schema |+--------------------+3 rows in set  (0.00 sec) MySQL >

Change Password

[Email protected] mysql-5.5.32]#/application/mysql//bin/mysqladmin-u root password ' qb123 '

[Email protected] mysql-5.5.32]# mysql-uroot-pqb123

Welcome to the MySQL Monitor. Commands End With; or \g.


Character:

[Email protected] ~]# cat/etc/sysconfig/i18n

Lang= "en_US. UTF-8 "

Sysfont= "Latarcyrheb-sun16"


Problem:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/95/39/wKioL1kS4RKT-GrEAAB--He2CFo547.jpg-wh_500x0-wm_ 3-wmp_4-s_1302254961.jpg "title=" 9.jpg "alt=" Wkiol1ks4rkt-greaab--he2cfo547.jpg-wh_50 "/>

fix installation;yum-y Install Openssl-devel



This article from "11773640" blog, declined reprint!

MySQL Installation and tuning

Related Article

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.