Linix (Centos) install MySQL

Source: Internet
Author: User
Tags file permissions

Linux(Centos)installationMysqlDatabaseuninstalling the original database

1, the query system has no database installed

Rpm-qa | grep MySQL

2. uninstalling the original database

RPM-E MySQL//normal Delete mode
RPM-E--nodeps MySQL//brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command can be strongly deleted
UseYumInstalling the Database

1.query The database version provided by Yum

Yum List | grep MySQL

2. Install the database

Yum install-y mysql-server MySQL Mysql-deve

3 . View the installed database version

Rpm-qi Mysql-server
4. Start the database
4.1. Service Mysqld Start
4.2.
If the 4.1 command does not start: mysql:unrecognized service
Use:
/etc/rc.d/init.d/mysqld start
Modify file Permissions
chmod 755/etc/rc.d/init.d/mysqld
You can use:
Service mysqld Start
Start
5. Check whether the database is powered up
Chkconfig--list | grep mysqld
6. Set Boot start
Chkconfig mysqld on

7 , set the initial password for the MySQL database root user

/usr/bin/mysqladmin-u root password ' new-password '

Or

Mysqladmin-u root password ' root '
Mysqlthe configuration file1, /etc/my.cnfthis isMysqlthe master configuration file

query content Cat ETC/MY.CNF

[Email protected] desktop]# CAT/ETC/MY.CNF

[Mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

# Disabling Symbolic-links is recommendedto prevent assorted security risks

Symbolic-links=0

[Mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

2, /var/lib/mysqlMysqlDatabase file storage location for database

[Email protected] lib]# CD mysql/

[email protected] mysql]# LL

Total 20488

-RW-RW----. 1 mysql mysql 10485760 Feb 1422:52 ibdata1

-RW-RW----. 1 mysql mysql 5242880 Feb 22:52 ib_logfile0

-RW-RW----. 1 mysql mysql 5242880 Feb 22:52 ib_logfile1

DRWX------. 2 mysql mysql 4096 Feb 22:51 MySQL

Srwxrwxrwx. 1 mysql mysql 0 Feb 22:52 mysql.sock

DRWX------. 2 mysql mysql 4096 Feb 22:51 test

3./var/logmysql database log output storage location


Linix (Centos) install MySQL

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.