Linux compilation installation and configuration-mysql (5.5,5.6) version System (note)

Source: Internet
Author: User
Tags mysql login

MySQL 5.5 (5.6) Later, need to compile with cmake (cross make, https://cmake.org/)

My environment is as follows:  

  VMware virtual machine, CentOS 5.5 x86_64 (kernel: 2.6.18-194.el5), SECURECRT client

First step: Install the development environment

[email protected] ~]# Yum groupinstall "Development Libraries"-y

Step two: Prepare CMake source Package/mysql Source Package  

[email protected] ~]# mkdir/app/soft-p

[email protected] ~]# Cd/app/soft

[email protected] soft]# RZ

[[email protected] soft]# ls
Cmake-3.3.2.tar.gz mysql-5.6.26.tar.gz

  Now see the cmake-3.3.2.tar.gz is CMake source compression package, can be downloaded to the https://cmake.org/download.

Mysql-5.6.26.tar.gz is: http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.26.tar.gz

Personal advice cmake, download version 2.8, address: http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz

  Unzip the source package  

[email protected] soft]# tar XF cmake-3.3.2.tar.gz
[[email protected] soft]# ls
Cmake-3.3.2.tar.gz mysql-5.6.26.tar.gz
cmake-3.3.2 mysql-5.6.26

Step three: Compile and install CMake  

[email protected] soft]# CD cmake-3.3.2
[[email protected] cmake-3.3.2]# ls
Auxiliary cmakelogo.gif ctestconfig.cmake Modules
Bootstrap cmake_uninstall.cmake.in CTestCustom.cmake.in readme.rst
cmakecpack.cmake compileflags.cmake dartconfig.cmake Source
CMakeCPackOptions.cmake.in Configure Doxygen.config Templates
cmakegraphvizoptions.cmake Contributing.rst Help Tests
CMakeLists.txt Copyright.txt Licenses Utilities
[email protected] cmake-3.3.2]#

[email protected] cmake-3.3.2]#./configure  

Of course, in addition to using the source code to compile the installation, you can also use yum install cmake-y mode.

This step, I have been tossing for a long time. Finally there is no way to uninstall the 3.3 version of CMake, reinstall 2.8 version, finally all kinds of wonderful problems will be gone,

Fourth step: Create MySQL database directory

I've added a new Sisc interface disk to use as a MySQL data disk,

[Email protected] ~]# Fdisk/dev/sdb

The number of cylinders for this disk was set to 2610.
There is nothing wrong with the, but this is larger than 1024,
And could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from the other OSs
(e.g., DOS fdisk, OS/2 fdisk)

Command (M for help): N

 Command Action
E Extended
p Primary partition (1-4)  

P

Partition number (1-4): 2

First cylinder (1826-2610, default 1826):

Using Default Value 1826

Last cylinder or +size or +sizem or +sizek (1826-2610, default 2610): +20g

Command (M for help): W

[Email protected] ~]# mke2fs-j/DEV/SDB2

[[email protected] ~]# mkdir/mydata/ # Create SDB2 hanging in directory

[[email protected] ~]# vim/etc/fstab # Disk auto Mount

/dev/volgroup00/logvol00/ext3 defaults 1 1
Label=/boot/boot ext3 Defaults 1 2
TMPFS/DEV/SHM TMPFS Defaults 0 0
Devpts/dev/pts devpts gid=5,mode=620 0 0
Sysfs/sys Sysfs Defaults 0 0
PROC/PROC proc Defaults 0 0
/DEV/VOLGROUP00/LOGVOL01 swap swap defaults 0 0
/dev/sdb2/mydata ext3 defaults 0 0

[Email protected] ~]# mount-a

[Email protected] ~]# mkdir/mydata/data-p

tip: In SECURECRT the fdisk command if the wrong argument is lost, backspace cannot delete the input character, use CTRL + BACKSPACE

Fifth step: Create MySQL user, group, group authorization

[[email protected] soft]# groupadd-r MySQL

[[email protected] soft]# useradd-r-g mysql-s/sbin/nologin MySQL

[Email protected] soft]# chown-r mysql.mysql/mydata/data

Sixth step: Compile MySQL (cmake. -LH, make && make install)

[email protected] soft]# CMake. -lh

[Email protected] soft]# CMake. -ddata_dir=/mydata/data # Set the MySQL database to the directory created for the fourth step, there are other parameters can be set here

for CMake, refer to here:http://www.ttlsa.com/mysql/configure-to-cmake/

[[email protected] soft]# make && make install

Seventh Step: Configure MySQL (MySQL installation directory genus/mysql init script)

[email protected] soft]# Cd/usr/local/mysql

[[email protected] mysql]# chown-r: Mysql/usr/local/mysql # set MySQL installation directory as a group of MySQL

[email protected] mysql]# scripts/mysql_install_db--user=mysql--datadir=/mydata/data

Installing MySQL system tables ...

Ok

........... The rest of the information has been ignored .....

Eighth Step: Configure MySQL (edit config file, mysqld service boot)

[email protected] mysql]# CP support-files/my-default.cnf/etc/my.cnf

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

[[email protected] mysql]# chkconfig--add mysqld # Add to boot Service list

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

Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[[Email protected] mysql]# service mysqld start

Starting MySQL ....          [OK] # Not easy Ah, the installation is complete, O (∩_∩) o ~ ~

nineth Step: Log in to MySQL  

   [[email protected] mysql]# ls
   bin data include Lib my.cnf README share support-files
   copying docs install-binary man mysql-test scripts Sql-bench
# I have added/usr/local/mysql/bin to path, but when I enter MySQL login, I get the following error
   mysql:error while loading shared libraries:libmysqlclient.so.15: Cannot open shared object File:no such file or directory
    p>

[[email protected] mysql]# Bin/mysql # in a different way, directly with the Bin/mysql, pay attention to OH. The whole path is actually/usr/local/mysql/bin/mysql .
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 8
Server version:5.6.26 Source distribution

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
4 rows in Set (0.00 sec)   

Tenth step: Simple security settings (delete anonymous user, change password)

mysql> drop user ' @localhost; LocalHost is the host name. Or you can directly modify the password for all users

mysql> Update Mysql.user set Password=password (' [email protected] ') where user= ' root '; Change Password

Mysql> flush Privileges; //Refresh, reload permissions  

Mysql> quit;
Bye
[[Email protected]]# bin/mysql
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
[Email protected]]# bin/mysql-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 11
Server version:5.6.26 Source Distribution

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

The new plus one allows "client IP address: 10.0.0.1; username: ocean; password: 123456 mysql user"

mysql> INSERT INTO Mysql.user (

Mysql> host,user,password,ssl_cipher,x509_issuer,x509_subject)

mysql> values (' 10.0.0.1 ', ' Ocean ', password (' 123456 '), ' , ', ', ');    

 parameter data:http://blog.chinaunix.net/uid-20577907-id-3082601.html

Notice Oh (ssl_cipher,x509_issuer,x509_subject, these three fields.) I write to the Mysql.user table when prompted that there is no default value, only add the three fields, generally only need to host,user,password on the,)

A 10.0.0.1 client connects to the data via Navicat.

11th step: Connect to MySQL without entering a password locally (in the user's home directory, edit a. my.cnf)

[email protected] ~]# Vi. my.cnf

[Client]
User=root
Host=localhost
[email protected]    

[Email protected] ~]#/usr/local/mysql/bin/mysql
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 17
Server version:5.6.26 Source Distribution

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

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

Aha, the notes are finally finished.

Warm tips and a small tool to save your clipboard pictures easily. Interested in the park friends try.

Easily save to any directory on your clipboard. "Support Ctrl + V Fast", may I see, perhaps you use it? ~

Http://www.cnblogs.com/oceanho/p/4714204.html

Linux compilation installation and configuration-mysql (5.5,5.6) version System (note)

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.