Mysql installation is nothing more than the following. yum installation is also a type of rpm installation, but this installation package does not need to be downloaded separately. it is relatively simple to install directly based on the mysql package that comes with the operating system, this article mainly introduces yum. in the future, we will install mysql in several other ways. among them, yum is also one of rpm installation methods, the installation package does not need to be downloaded separately. it is relatively simple to install the package directly based on the mysql package that comes with the operating system. This article mainly describes yum and will summarize several other methods in the future.
Current installation method
1. rpm installation
2. binary installation
3. source code installation
4. install yum
Yum installation
1. install the operating system
1.1 install Red Hat Enterprise Linux 6.2 (64-bit)
Arch: x86_64
1.2. disable selinux vi/etc/selinux/config
1.3. service iptables stop temporarily closes the firewall
2. install MySQL
2.1 mount the Redhat image file ftp: // 192.168.0.212/pub/iso/rhel6.2/. the command is as follows:
# Mkdir-p/mnt/iso
# Mkdir-p/mnt/redhat5.5
# Mount 192.168.0.212:/var/ftp/pub/iso/rhel5.5 // mnt/iso/
# Mount-t iso9660-o loop rhel-server-5.5-x86_64-dvd.iso/mnt/redhat5.5/
2.2 configure yum
# Cd/etc/yum. repos. d/
# Cp rhel-debuginfo.repo rhel-debuginfo.repo_bak
# Vi rhel-debuginfo.repo
[Rhel-debuginfo]
Name = Red Hat Enterprise Linux $ releasever-$ basearch-Debug
Baseurl = file: // mnt/redhat5.5/Server
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Oracle @ Redhat5 yum. repos. d] $ ls
El5u5. repo el5u8. repo rhel-debuginfo.repo
[Oracle @ Redhat5 yum. repos. d] $ cat el5u8. repo
[Server]
Name = Red Hat Enterprise Linux 5 update 8
Baseurl = ftp: // 192.168.0.212/pub/src/RHEL5U8/x64/Server
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
Name = Red Hat Enterprise Linux 5 update 8
Baseurl = ftp: // 192.168.0.212/pub/src/RHEL5U8/x64/VT
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Cluster]
Name = Red Hat Enterprise Linux 5 update 8
Baseurl = ftp: // 192.168.0.212/pub/src/RHEL5U8/x64/Cluster
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
Name = Red Hat Enterprise Linux 5 update 8
Baseurl = ftp: // 192.168.0.212/pub/src/RHEL5U8/x64/ClusterStorage
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
2.3 Create a mysql data storage directory as needed
# Mkdir/mysqldata
2.4 install mysql and mysql-server in yum
# Yum install mysql-server
2.5 modify the mysql configuration file
# Vi/etc/my. cnf
[Mysqld]
Datadir =/data/mysql
Socket =/var/lib/mysql. sock
User = mysql
# Default to using old password format for compatibility with mysql 3.x
# Clients (those using the mysqlclient10 compatibility package ).
Old_passwords = 1
Default-character-set = utf8
# Disabling symbolic-links is recommended to prevent assorted security risks;
# To do so, uncomment this line:
# Symbolic-links = 0
Lower_case_table_names = 1
[Mysqld_safe]
Log-error =/var/log/mysqld. log
Pid-file =/var/run/mysqld. pid
[Mysql]
Default-character-set = utf8
2.6 start mysql and add mysql to start automatically
#/Etc/rc. d/init. d/mysqld start
# Chkconfig mysqld on
# Chkconfig -- list mysqld
2.7 modify the mysql password
# Mysql-u root
/Usr/bin/mysqladmin-u root password 123456
Mysql> grant all on mysql. * to 'root' @ 'localhost' identified by 'mysql8895'
Mysql> source/opt/MYSQL. SQL import data
Mysql> exit
Create a user:
Mysql> grant all on dcs. * to "ligang" @ "%" identified by "dcsA99ligang ";