Linux Server Installation MySQL database

Source: Internet
Author: User
Tags save file

Installation package: mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz

Use Xshell to connect to the Linux server, log in with the root user name, and execute the following command in turn:

======================================================

/usr/sbin/groupadd MySQL "add MySQL Group"

/usr/sbin/useradd-d/var/lib/mysql-s/sbin/nologin-g MySQL MySQL

Mkdir-p/usr/local/src/mysql "new MySQL folder"

CD/"Open the directory of the upload installation package"

Mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz "Upload the installation package to the root directory of the server"

MV Mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz/usr/local/src/mysql "root directory installation package moved to folder"

Cd/usr/local/src/mysql "Open Directory"

TAR-ZXVF mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz "Unpacking the installation package"

CP Mysql-5.6.30-linux-glibc2.5-x86_64/usr/local/mysql-r "Copying Files"

Cd/usr/local "Open Directory"

Chown-r Mysql:mysql mysql/

cd/usr/local/mysql/scripts/"Open Directory"

./mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data "Execute Script"

Cd/usr/local/mysql/support-files "Open Directory"

CP my-default.cnf/etc/my.cnf "Copy files to new path and file name"

cp:overwrite '/etc/my.cnf '? Y"y"

CP Mysql.server/etc/init.d/mysql "Copy files to a new path"

Vim/etc/profile "Editing software operating Environment"
Vim I (edit some content) ESC (enter normal) W (save file) Q (Do not save exit file)
###############################################################
Export Mysql_home=/usr/local/mysql
Export path= $MYSQL _home/bin: $PATH
###############################################################
Source/etc/profile

Chkconfig--add MySQL

Chkconfig MySQL on


Service MySQL Start
/usr/local/mysql/bin/mysqladmin-u root password ' rootroot ' "Modify the password of the database root"


Grant all privileges the tdcdb.* to ' root ' @ '% ' identified by ' rootroot ' "Assigning permissions to MySQL users"
Flush privileges;

Vim/etc/sysconfig/iptables "Edit Access port number"
###############################################################
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT (add 3306 port number)
###############################################################
Service Iptables Restart
Netstat-ntlp

Mysql-u root-p (Command not found using: Ln-s/usr/local/mysql/bin/mysql/usr/bin)
Create user ' TDC ' @ '% ' identified by ' [email protected] '; ' Creating database Access user '
Create database if not exists ' tdcdb ';

Grant all privileges the tdcdb.* to ' TDC ' @ '% ' identified by ' [email protected] '; ' Assigning access passwords to TDC users '
Flush privileges;

VI/ETC/MY.CNF "Edit configuration file, support language Settings"
###############################
[Client]
Default-character-set=utf8

[Mysqld]
Character-set-server=utf8

[MySQL]
Default-character-set=utf8
###############################
Service MySQL Stop "restart MySQL service"
Service MySQL Start

======================================================

Linux Common commands:

PWD: View current path

Ll:2 a lowercase l to view all files in the current directory

CD: Open directory, including path address and folder

VI File name: Edit the files under Linux, use the uppercase "I" command to edit, after editing, click the "ESC" button to jump out of the edit, enter ": wq! "Command to exit the save;

Note: Linux files can not be opened directly modified, can only be modified by the VI command

======================================================

How to uninstall a program:

Ps-ef | grep MySQL
/etc/init.d/mysql status
Whereis MySQL
Find/-name MySQL "found all files named MySQL file list"
rm-rf/usr/local/mysql/"Using the RM command to remove files from a list"
RM-RF/ETC/MY.CNF "Using the RM command to remove files from a list"

Linux Server Installation MySQL database

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.