MySQL binary installation

Source: Internet
Author: User

Check if MySQL is already installed

rpm-qa| grep MySQL

[Email protected]/]# Rpm-qa | grep MySQL
Mysql-libs-5.1.71-1.el6.x86_64

Uninstall MySQL

Rpm-e Mysql-libs–nodeps

Find out about MySQL files in your computer and delete them as much as possible, if any
Like/etc/my.cc or/etc/mysql.

Download and unzip the installation package
The official: http://dev.mysql.com/downloads/mysql/
Linux-generic
(mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz)

My installation directory is:/home/mysql

#安装libaio库yum Search Libaio Yum install Libaio#移动mysql更目录到需要安装的地方cd/HOME/SETUP/CLEARTAR-ZXVF mysql-5.7.17-LINUX-GLIBC2.5-x86_64.tar.gzmv/home/setup/mysql-5.7.17-LINUX-GLIBC2.5-x86_64/home/mysql#复制配置文件cp/home/mysql/support-files/my-default.cnf/etc/My.cnf#修改配置文件 Modify the content as follows vi/etc/MY.CNF Basedir =/home/mysql/datadir =/Home/mysql/dataport =320WSocket =/home/mysql/tmp/mysql.sock#创建data, tmp directory Cd/home/mysqlmkdir datamkdir tmp#创建不可登陆用户及组groupadd Mysqluseradd-r-G MySQL-S/bin/false MySQL#增加目录权限cd/home/mysqlChown-r MySQL. chgrp-r MySQL.#复制mysqldcp/home/mysql/support-files/mysql.server/etc/init.d/mysqldchmod755/etc/init.d/mysqld#初始化数据库cd/home/mysql/bin./mysqld--user=mysql--basedir=/home/mysql--datadir=/home/mysql/data--initialize[note] A temporary password is generated for [email protected]: B,prkho. n8sm# need to be aware of timestamp settings--explicit_defaults_for_timestamp# start service mysqld start# if the following error is reported: You need to go to Next1[[email Protected] bin]# service mysqld startstarting mysql.logging to '/home/mysql/data/test.myhome.m.hzwh.com.err '. 2017-05-02t00:20:15.262870z Mysqld_safe the FILE/USR/local/mysql/bin/mysqlddoesNot existOr isNot executable. Please CD to the MySQL Installationdirectoryand restart this script from there as Follows:./bin/mysqld_safe&see http:Dev.mysql.com/doc/mysql/en/mysqld-safe.htmlFor more information error! The server quit without updating PID file (/home/mysql/data/test.myhome.M.HZWH.COM.PID).#NEXT1#创建/usr/local/mysql/bin Directory cd/usr/Localmkdir MYSQLCD MySQLMkDir bin#建立链接ln-s/home/mysql/bin/mysqld/usr/Local/mysql/bin/mysqld#启动mysqldservice mysqld Start#客户端连接cd/home/mysql/bin./mysql-u root-p Enter Password: This is just the password: b,prkho. N8SM if the following error is reported, go to Next2[root@test bin]#./mysql-u Root-penter Password:error2002 (HY000): Can' t connect to local MySQL server through socket '/tmp/mysql.sock' (2) #NEXT2ln-S/home/mysql/tmp/mysql.sock/tmp/mysql.sock./mysql-u root-p# Login Success # change the root password to 123456mysql>set Password=password ('123456'); #创建用户mysql >create USER ' FSWH' @ ' localhost' Identified by ' Fswh888$ ';#创建数据库test_dbmysql > CREATE DATABASE IF not EXISTS' Fswh_vipsys ' DEFAULT CHARACTER SET' UTF8 ' COLLATE' Utf8_unicode_ci ';#用户授权数据库#只容许本地访问mysql > GRANT All privileges the fswh_vipsys.* to FSWH@ ' localhost';mysql> flush privileges; #开启远程访问, under Linux for security, the default is not to allow machines outside of MySQL to access the MySQL database service, so users need to be re-authorized. Mysql> GRANT all privileges in fswh_vipsys.* to [email protected] '% ' identified by ' fswh888$ ';mysql> flush privileges;  #mysql Modify user name password mysql> use mysql;mysql> UPDATE user SET Password=password ("test123") WHERE user=' root '; Mysql> flush privileges;mysql> exit;  #设置开机启动#检查自启动项列表中没有mysqld这个, if not, add Mysqldchkconfig--list mysqldchkconfig--add mysqld# Set MySQL to automatically start on the 345 level chkconfig--level 345 mysqld on#或用这个命令设置开机启动chkconfig mysqld on#mysql服务的启动/restart/ Stop service mysqld startservice mysqld restartservice mysqld stop          

MySQL binary installation

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.