Chinaunix首页 | 论坛 | 博客
  • 博客访问: 268430
  • 博文数量: 78
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 852
  • 用 户 组: 普通用户
  • 注册时间: 2013-05-06 11:01
个人简介

不做第二个别人,永远做第一个自己。

文章分类

全部博文(78)

文章存档

2014年(60)

2013年(18)

分类: Mysql/postgreSQL

2014-04-10 11:19:27

7] Install MySQL for Database Server
[root@cloud01 ~]# yum -y install mysql-serve
[root@cloud01 ~]# /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 cloud01 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
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
[root@cloud01 ~]# chkconfig mysqld on
[root@cloud01 ~]# 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.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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;
+——–+———–+———-+
| user | host | password |
+——–+———–+———-+
| root | localhost | |
| root | cloud01 | |
| root | 127.0.0.1 | |
| | localhost | |
| | cloud01 | |
+——–+———–+———-+
5 rows in set (0.00 sec)
# 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@’127.0.0.1′=password(‘password’); 
Query OK, 0 rows affected (0.00 sec)
# set root password
mysql> set password for root@’cloud01′=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;
+——–+——————-+——————————————-+
| user | host | password |
+——–+——————-+——————————————-+
| root | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | cloud01 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+——–+——————-+——————————————-+
3 rows in set (0.00 sec)
mysql> exit # quit
Bye
[root@cloud01 ~]# 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 3
Server version: 5.1.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> exit
Bye

阅读(635) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~