Centos6.5 mysql tossing notes, centos6.5mysql tossing

Source: Internet
Author: User
Tags mysql login

Centos6.5 mysql tossing notes, centos6.5mysql tossing
1. Install mysql in yum

[root@localhost ~]# yum -y install mysql-server
Installation result
Installed:  mysql-server.x86_64 0:5.1.73-7.el6                                                            Dependency Installed:  mysql.x86_64 0:5.1.73-7.el6                perl-DBD-MySQL.x86_64 0:4.013-3.el6               Complete!
2. Set startup
[root@localhost ~]# chkconfig mysqld on
3. MySQL service 3.1 and MySQL service enabled
[root@localhost ~]# service mysqld start
3.2 MySQL service closed
[root@localhost ~]# service mysqld stop
3.1 MySQL service restart
[root@localhost ~]# service mysqld restart
4. Set MySQL password 4.1 and password
[root@stonex ~]#  mysql -u rootmysql> set password for root@localhost=password('root');mysql> exit
4.2 forgot password 4.2.1, modify/etc/my. cnf
1 [mysqld] 2 datadir =/var/lib/mysql 3 socket =/var/lib/mysql. sock 4 user = mysql 5 # The most important code below 6 skip-grant-tables 7 # Disabling symbolic-links is recommended to prevent assorted security risks 8 symbolic-links = 0 9 10 [mysqld_safe] 11 log-error =/var/log/mysqld. log12 pid-file =/var/run/mysqld. pid
4.2.2 restart MySql
[root@localhost ~]# service mysqld restart
4.2.3. Change the password
1 [root@localhost ~]# mysql -u root2 mysql> use mysql;3 mysql> set password for root@localhost=password('root');4 mysql> flush privileges;5 mysql> exit;6 [root@localhost ~]# service mysqld restart
4.2.4 Modify/etc/my. cnf
[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid
4.3 MySQL Login
[root@localhost ~]# mysql -u root -p
4.4 MySQL Common commands
1 show databases; // view the existing database in the System 2 use databasesname; // select the database to be used 3 drop database databasename; // Delete the selected database 4 exit // exit the database connection 5 create database test01; // create a database named test 6 show tables; // list tables in the current database. 7. add, delete, modify, and query other basic tables. Use standard SQL.
4.5 MySQL opens remote login Permissions
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;FLUSH PRIVILEGES;

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.