Install mysql in yum or mysqllinuxyum on linux
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 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 ";
In linux, where is the installation path after mysql is installed using yum? Where is the binfile of mysql?
Use rpm-qa \ * mysql \ * to check which packages you have installed, and then run rpm-ql xxxxxxx to check the specific package installation location.
Installing mysql in linux? How to install it?
In ubuntu or debian, you need to run:
Apt-get install mysql5-server