Virtual machine changed to Network address translation (NAT)
Service Network restart
Ping www.baidu.com
Rpm-qa | grep MySQL
Some words are unloaded by the following command
RPM-E MySQL//normal Delete mode
RPM-E--nodeps MySQL//brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command can be strongly deleted
Two: Install MySQL
Install packages required for compiling code
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
Useradd mysql-s/sbin/nologin
cat/etc/passwd | grep MySQL
Cat/etc/group | grep MySQL
Mkdir/usr/src/mysql
SOURCE Directory
Cd/usr/src/mysql
There are no identified parameters tested here.
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/var/lib/mysql-dsysconfdir=/etc-dwith_myisam_storage_ Engine=1-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith _federated_storage_engine=1-dwith_partition_storage_engine=1-dmysql_unix_addr=/tmp/mysqld.sock-denabled_local_ Infile=1-dextra_charsets=all-dmysql_user=mysql-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dextra _charsets=all-dmysql_tcp_port=3306
Make
Make install
Go to installation path
Cd/usr/local/mysql
Enter the installation path, execute the initialization configuration script, create the system's own database and table
scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql
Note: When starting the MySQL service, will be in a certain order to search my.cnf, first in the/etc directory, find will search "$basedir/my.cnf", in this case is/usr/local/mysql/ MY.CNF, this is the default location for the new MySQL configuration file!
Cd/usr/local/mysql
Basedir=/usr/local/mysql
Datadir=/var/lib/mysql
Port= 3306
Socket=/temp/mysqld.sock
Add services, Copy service scripts to the INIT.D directory, and set boot boot
CP Support-files/mysql.server/etc/init.d/mysql
Chkconfig MySQL on
Service MySQL Start--start MySQL
After MySQL starts successfully, Root does not have a password, we need to set the root password.
Before setting, we need to set path, or we can't call MySQL directly
Modify the/etc/profile file to add at the end of the file
Path=/usr/local/mysql/bin: $PATH
Export PATH
Close the file, run the following command, and let the configuration take effect immediately
Source/etc/profile
Cd
VI. bash_profile
Path= $PATH/bin:/usr/local/mysql/bin
SOURCE ~/.bash_profile
Execute the following command to modify the root password
Mysql-uroot
mysql> SET PASSWORD = PASSWORD (' 123456 ');
To set the root user to have remote access, perform
Mysql> GRANT All privileges on * * to ' root ' @ ' 172.16.% ' identified by ' password ' with GRANT OPTION;
Flush privileges;
Configuring firewalls
Etc/sysconfig/iptables
Under "-A input–m State--state new–m tcp–p–dport 22–j ACCEPT", add:
-A input-m state--state new-m tcp-p-dport 3306-j ACCEPT
Then save and close the file, run the following command in the terminal and refresh the firewall configuration:
Service Iptables Restart
Not tested here
Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-dsysconfdir=/etc-dwith_ Myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_ Unix_addr=/var/lib/mysql/mysql.sock-dmysql_tcp_port=3306-denabled_local_infile=1-dwith_partition_storage_ Engine=1-dextra_charsets=all-ddefault_charset=utf8-ddefault_collation=utf8_general_ci
Make && make install
Parameter description:
-dcmake_install_prefix=/work/installed/mysql//installation directory
-dinstall_datadir=/work/installed/mysql/data//Database storage directory
-
-ddefault_charset=utf8//using UTF8 characters
-
-DDEFAULT_COLLATION=UTF8_GENERAL_CI//Check character
-
-dextra_charsets=all//Install all extended character sets
-
-denabled_local_infile=1//Allow import of data from local
TAR-ZXVF cmake .....
CD CMake .....
Installing CMake
./configure--prefix=/usr/local/cmake
Gmake make Install
./cmake.sh Gmake Make Install
Mkdir/var/lib/mysql
Chown Mysql.mysql
ll
Ls
:(Configure.cmake)
Cd/usr/local/mysql
CD support-files/
Mysql.server
CP Mysql.server/etc/init.d/mysql
CP MY-DEFAULT.CNF/ETC/MY.CNF
VI my.cnf
Basedir=/usr/local/mysql
Datadir=/var/lib/mysql
Port= 3306
Socket=/temp/mysqld.sock
cd/usr/local/mysql/scripts/
./mysql_install_db--help
./mysql_install_db--basedir=/usr/local/msql/--datadir=/var/lib/mysql--no-defaults--usre=mysql
Cd/var/lib/mysql
Service MySQL Start
Ps-ef |grep MySQL
cd/usr/local/mysql/
CD bin/
./mysql
Cd
VI. bash_profile
Path= $PATH/bin:/usr/local/mysql/bin
SOURCE ~/.bash_profile
All Users
Vi/etc/bashrc
Path= $PATH:/usr/local/mysql/bin
CMake. -dcmake_install_prefix=/work/installed/mysql-dmysql_datadir=/work/installed/mysql/data-ddefault_charset=utf8- Ddefault_collation=utf8_general_ci-dextra_charsets=all-denabled_local_infile=1
Examples sample programs and scripts
Include (header) file
LIB Library
Scripts Utility Script
Share error message File
After installation using MySQL AB's Linux rpm distribution, files are generated in the following system directories:
Directory directory Contents
Chapter 2. Installing MySQL
FILE:///D:/DOWNLOAD/REFMAN-5.1-ZH.HTML-CHAPTER/REFMAN-5.1-ZH.HTML-CHAPTER/INSTALLING.HTML[2010/2/24 5:21:24]
/usr/bin client programs and scripts
/usr/sbin mysqld Server
/var/lib/mysql log files, database
/usr/share/doc/packages Documentation
/usr/include/mysql contains (header) files
/usr/lib/mysql Library
/usr/share/mysql error messages and character set files
/usr/share/sql-bench Benchmark Program
In Unix, you can unzip and install the tar file binary distribution (Typically/usr/local/mysql) at the installation location of your choice and create the following directory at that location:
Directory directory Contents
Bin client program and MYSQLD server
Data log file, database
Docs document, ChangeLog
Include (header) file
LIB Library
Scripts mysql_install_db
Share/mysql error Message File
Sql-bench Benchmark Program
After the source distribution is configured and compiled, the installation begins. By default, you can install files to/usr/local, which is in the following subdirectory:
Directory directory Contents
Bin client programs and scripts
Include/mysql contains (header) files
Documents in Info Info format
Lib/mysql Library
Libexec mysqld Server
Share/mysql error Message File
Sql-bench Benchmark program and CRASH-ME test
var database and log files
In one installation directory, the layout of the source installation differs from the binary installation in the following ways:
· The MYSQLD server is installed in the "libexec" directory instead of in the "Bin" directory.
· The data directory is "Var" and not "data".
· MYSQL_INSTALL_DB is installed in the "bin" directory rather than "scripts".
· header files and library directories are "Include/mysql" and "lib/mysql" rather than "include" and "Lib".
MySQL in Cento under the source installation