Install MySQL on CentOS6

Source: Internet
Author: User

[Root @ www.bkjia.com ~] # Yum-y install mysql-server
[Root @ www.bkjia.com ~] #/Etc/rc. d/init. d/mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
Support-files/mysql. server to the right place for your system

Please remember to set a password for the MySQL root USER!
To do so, start the server, then issue the following commands:

/Usr/bin/mysqladmin-u root password 'new-password'
/Usr/bin/mysqladmin-u root-h www. server. world password 'new-password'

Alternatively you can run:
/Usr/bin/mysql_secure_installation

Which will also give you the option of removing the test
Databases and anonymous user created by default. This is
Stronugly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon:
Cd/usr;/usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
Mysql-test-run.pl for cd/usr/mysql-test; perl

Please report any problems with the/usr/bin/mysqlbug script!

Starting mysqld: [OK]

[Root @ www.bkjia.com ~] # Chkconfig mysqld on
[Root @ www.bkjia.com ~] # Mysql-u root # connect to MySQL
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 2
Server version: 5.1.52 Source distribution

Copyright (c) 2000,201 0, Oracle and/or its affiliates. All rights reserved.
This software comes with absolutely no warranty. This is free software,
And you are welcome to modify and redistribute it under the GPL v2 license

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

# Show user info
Mysql> select user, host, password from mysql. user;

# Set root password
Mysql> set password for root @ localhost = password ('Password ');
Query OK, 0 rows affected (0.00 sec)
# Set root password
Mysql> set password for root @ '2014. 0.0.1 '= password ('Password ');
Query OK, 0 rows affected (0.00 sec)
# Set root password
Mysql> set password for root @ 'www. server. world' = password ('Password ');
Query OK, 0 rows affected (0.00 sec)
# Delete anonymous user
Mysql> delete from mysql. user where user = '';
Query OK, 2 rows affected (0.00 sec)
Mysql> select user, host, password from mysql. user;

Mysql> exit # quit
Bye
[Root @ www.bkjia.com ~] # Mysql-u root-p # connect with root
Enter password: # MySQL root password
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 4
Server version: 5.1.52 Source distribution

Copyright (c) 2000,201 0, Oracle and/or its affiliates. All rights reserved.
This software comes with absolutely no warranty. This is free software,
And you are welcome to modify and redistribute it under the GPL v2 license
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

Mysql> exit
Bye

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.