centos7 tar whole process installation Source Package mysql

1.tar -zxvf mysq.tar file (opt folder)

2. The first cd to the mysql directory, note the following line by line replication. In the implementation of the following

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_ENHINE=1
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci

  1. make && make install

4. Configure MySQL

Setting permissions

Use the following command to see if there mysql users and user groups

cat / etc / passwd see the user list
cat / etc / group to view the list of user groups
if not created

groupadd mysql
useradd -g mysql mysql
修改/usr/local/mysql权限
chown -R mysql:mysql /usr/local/mysql

Initial configuration, into the installation path (in the following instruction), an initialization configuration script, the system comes to create databases and tables
CD / usr / local / MySQL
Centos7: It should add: yum install 'perl (Data :: Dumper ) '
scripts / --basedir the mysql_install_db = / usr / local / MySQL --datadir = / usr / local / MySQL / Data --user = MySQL [this is an instruction]
Note: when the service start MySQL, it will follow a certain order Search my.cnf, first look in the / etc directory, it will not find the search "$ basedir / my.cnf", in this case, it is /usr/local/mysql/my.cnf, which is a new version of MySQL configuration the default location of the file!

Note: After installation is complete, the smallest version of CentOS 6.8 operating system, there will be a my.cnf in the / etc directory, you need this file renamed to other names, such as: /etc/my.cnf.bak, otherwise, the Source files can interfere with proper installation of MySQL configuration, resulting not start.
Change the name to prevent interference:
mv /etc/my.cnf /etc/my.cnf.bak

Start MySQL
added service, copy service script to init.d directory, and set the boot
[Note executed under / usr / local / MySQL]
cp Support-Files / mysql.server /etc/init.d/mysql
chkconfig MySQL ON ( set boot from the start)
service MySQL start - start MySQL (here I am centos7 systemctl startup mode failure, or service start)

Run the following commands to modify the root password
CD / usr / local / MySQL / bin
./mysql -uroot-
MySQL> the SET PASSWORD = PASSWORD ( 'root');
configure the environment variables:
Vim / etc / Profile (in this document)
in the most under the plus (where configured jdk environment variable is true)
the PATH = / usr / local / MySQL / bin: $ the PATH
Export the PATH
refresh profile file
source / etc / profile
success!

Note: When a remote connection
encounter the following error message when configuring a remote connection Mysql database, which is due to the Mysql configuration does not support remote connection caused
1130 - Host XXX is not allowed to connect to this MySQL server.

解决:
update user set host = ‘%’ where user =‘root’;

flush privileges;

Published 10 original articles · won praise 0 · Views 284

Guess you like

Origin blog.csdn.net/wzwwzwwww/article/details/104464515