Install mysql-server on CentOS (mysql Installation Guide for Linux)

Source: Internet
Author: User

Install mysql-server on CentOS (mysql Installation Guide for Linux)
0: determine the system information:

[Root @ mongodt mysql] # cat/etc/issue
CentOS release 6.4 (Final) Kernel \ r on an \ m
I. yum Installation
[Op1 @ VMS06968 ~] $ Yum list mysql *
Loaded plugins: downloadonly, fastestmirror, security
Determining fastest mirrors
Installed Packages
MySQL-client.x86_64 5.6.21-1. el6 @ custom.
Mysql-libs.x86_64 5.1.66-2. el6_3 @ anaconda-CentOS-201303020151.x86_64/6.4
Available Packages
MySQL-devel.x86_64 5.6.21-1. el6 custom.
MySQL-python.x86_64 1.2.3-0.3.c1.1.el6 base
MySQL-server.x86_64 5.6.21-1. el6 custom.
# Install the server [op1 @ VMS06968 ~] $ Yum install mysql-server
# Install the client [op1 @ VMS06968 ~] $ Yum install mysql
If an error is reported during installation, run the following command to delete the mysql-related lib:; and then perform the two steps for installation. [op1 @ VMS06968 ~] $ Yum remove mysql *
Ii. Know the installation directory of mysql:2.1 database directory/var/lib/mysql/
2.2 configuration file/usr/share/mysql (mysql. server command and configuration file)
2.3 related commands/usr/bin (mysqladmin mysqldump and other commands)
2.4.1. Start Script 1/etc/rc. d/init. d/mysql (mysql directory of the startup script file) 2.4.2, start Script 2/etc/init. d/mysql (directory for starting the script file mysql)
2.5mysql configuration file/usr/my. cnf (find it) 3. Edit the/usr/my. cnf file as follows:
[Root @ mongodt mysql] # vi/usr/my. cnf # export = 0.0.0.0port = 3306
[Mysqld] datadir =/var/lib/mysqlsocket =/var/lib/mysql. sockcharacter-set-server = utf8sql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLESdefault-storage-engine = INNODB # default data storage format max_connections = 10innodb_buffer_pool_size = 256 M # Memory query_cache_size = 30 M
[Mysql] default-character-set = utf8
4. Restart the mysql service and modify the default password:1) mysqladmin-u root password 'newpassword:
[Root @ mongodt mysql] # mysqladmin-u root password 'root' ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)
1. Stop mysql service: #/etc/rc. d/init. d/mysqld stop2. Enter the command: # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking & 3. log on to the database: # mysql-u root mysql4, mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD ('root') where USER = 'root'; mysql> flush privileges; mysql> quit5. Restart the service: #/etc/init. d/mysql restart if a new user name is used, the following error is returned when logging in with the password:
Mysql> show databases; ERROR 1820 (HY000): You must set password before executing this statement
6. Run mysqladmin-u root-proot password 'root'. Now the root user can use the data normally. # mysql-u root-proot # the data can be used normally! V. Start the mysql service and set it as a system service:
# Chkconfig mysqld on startup
# Chkconfig-list mysqld restart confirm MySQL self-starting mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off slave if 2-5 is on status OK
# Service mysqld start restart start the service (#/etc/rc. d/init. d/mysqld start)
6. Delete anonymous users and Test Databases:
Delete from mysql. user where user = "; then delete anonymous users select user, host from mysql. user; then view user information
Select version (), current_date; # current version information, date and database: show databases; Tables: view existing databases in the system drop database test; Tables: delete empty databases named test







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.