Install mysql and linuxmysql in linux
1. Check whether the grep is installed. The-I option of grep indicates that case sensitivity is ignored when matching.
[Root @ localhost JavaEE] # rpm-qa | grep-I mysql
Mysql-libs-5.1.61-4.el6.x86_64
* It can be seen that the library file has been installed and should be uninstalled first. Otherwise, a overwriting error will occur. Note: The -- nodeps option is used for loading, and dependency is ignored:
[Root @ localhost JavaEE] # rpm-e mysql-libs-5.1.61-4.el6.x86_64 -- nodeps
2. Download the MySQL Installation File
The following two files are required to install MySQL:
MySQL-server-4.0.16-0.i386.rpm
MySQL-client-4.0.16-0.i386.rpm
For: http://www.mysql.com/downloads/mysql-4.0.html, open this page, drop-down page to find the "Linux x86 RPM downloads" item, find the "Server" and "Client programs" item, download the above two rpm files.
A InstallationServerEnd
Run the following command in the directory with two rmp files:
[Root @ test1 local] # rpm-ivh MySQL-server-4.0.16-0.i386.rpm
The following information is displayed.
Warning: MySQL-server-4.0.16-0.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ######################################## ### [100%]
1: mySQL-server ##################################### ###### [100%]
...... (Omitted)
/Usr/bin/mysqladmin-u root password 'new-password'
/Usr/bin/mysqladmin-u root-h test1 password 'new-password'
...... (Omitted)
Starting mysqld daemon with databases from/var/lib/mysql
If the preceding information is displayed, the Server installation is complete.
Check whether the mysql service is started
Ps-ef | grep mysql
Service mysql start
B. Enter mysql
Mysql-u root-p
C. Modify the root user password
Mysql-u root-p password
D. Check whether the character set in mysql is UTF-8
Show variable like 'chara %'
E. modify the configuration file and change the character encoding.
Configuration File:/usr/share/mysql/my-small.cnf
Modify to copy my-small.cnf to/etc/my. cnf
Modify my. cnf
Add the following content under [mysqld:
Character_set_server = utf8
After modification, restart the mysql service: service mysql restart.
F. Disable the Firewall:
Method 1: service iptables stop (not available)
Method 2: Open Port: iptables-I INPUT-p tcp -- dport 3306-j ACCEPT
Service iptables save
G. View mysql logs:/var/lib/mysql
H. authorization is required to access mysql.
Grant all privileges on *. *Root @ '%'Identified
By 'database password' with grant option;
Flush privileges; refresh mysql system tables