Install MySQL in yum and set the password

Source: Internet
Author: User

Yum install MySQL and set password Shell code yum install mysql-server yum install mysql-devel chgrp-R mysql/var/lib/mysql chmod-R 770/var/lib/ mysql service mysqld start mysql set password for 'root' @ 'localhost' = PASSWORD ('secret _ password '); set the default encoding and other initial parameters (my. cnf) (if my. cnf, You Can cp/usr/share/mysql/my-small.cnf/etc/my. cnf) vi/etc/my. cnf [mysqld] datadir =/var/lib/mysql socket =/var/lib/mysql. sock user = mysql default-character-set = utf8 [add] default-storage-engine = INNODB [add] old_passwords = 1 [client] default-character-set = utf8 [add] [mysqld_safe] log-error =/var/log/mysqld. log pid-file =/var/run/mysqld. the following is the general operation of pid: Change the root password: mysqladmin-u root password 'newpassword' add mysql user: grant all privileges on my_db. * TO 'user' @ 'localhost' identified by 'Password'; DELETE the test DATABASE: mysql-u root-p mysql> drop database test; DELETE an anonymous account: delete from mysql. user WHERE user = ''; overload permission: mysql> flush privileges; if you want other machines to access it, in mysql. add a user whose Host is '%' to the user, then flush priviledges; and then add a statement similar to this to the firewall (enable port 3306 ): shell code-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT if you want reboot self-starting: Shell code chkconfig -- levels 345 mysqld on

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.