yum安装MYSQ配置

 

[root@RHEL6 /home/jxd]$yum -y install mysql-server      (解决了依赖问题)
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.61-4.el6 will be installed
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.61-4.el6.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.61-4.el6.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.61-4.el6.x86_64
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
======================================================================================================================================
 Package                             Arch                        Version                            Repository                   Size
======================================================================================================================================
Installing:
 mysql-server                        x86_64                      5.1.61-4.el6                       Server                      8.6 M
Installing for dependencies:
 perl-DBD-MySQL                      x86_64                      4.013-3.el6                        Server                      134 k
 perl-DBI                            x86_64                      1.609-4.el6                        Server                      707 k
 
Transaction Summary
======================================================================================================================================
Install       3 Package(s)
 
Total download size: 9.4 M
Installed size: 27 M
Downloading Packages:
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                  42 MB/s | 9.4 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : perl-DBI-1.609-4.el6.x86_64                                                                                        1/3 
  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                  2/3 
  Installing : mysql-server-5.1.61-4.el6.x86_64                                                                                   3/3 
Installed products updated.
  Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                  1/3 
  Verifying  : mysql-server-5.1.61-4.el6.x86_64                                                                                   2/3 
  Verifying  : perl-DBI-1.609-4.el6.x86_64                                                                                        3/3 
 
Installed:
  mysql-server.x86_64 0:5.1.61-4.el6                                                                                                  
 
Dependency Installed:
  perl-DBD-MySQL.x86_64 0:4.013-3.el6                                  perl-DBI.x86_64 0:1.609-4.el6                                 
 
Complete!
 
启动服务
[root@RHEL6 /home/jxd]$ service 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 RHEL6.2 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@RHEL6 /home/jxd]$service mysqld status
mysqld (pid  2821) is running...
 
更改mysql密码
[root@RHEL6 /home/jxd]$/usr/bin/mysqladmin -u root password 'root'
 
查看mysqld开机启动服务状态
[root@RHEL6 /home/jxd]$chkconfig --list |grep mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
下次开机自启动mysqld
[root@RHEL6 /home/jxd]$chkconfig mysqld on
[root@RHEL6 /home/jxd]$chkconfig --list |grep mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
 
登录mysql
[root@RHEL6 /root]$mysql -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.61 Source distribution
 
Copyright (c) 2000, 2011, 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> quit
Bye
 
设置别名登录mysql
[root@RHEL6 /etc]$grep mysql bashrc
alias mysql='mysql -uroot -proot'
 
测试(需要重新登录一次):
[root@RHEL6 /root]$mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.1.61 Source distribution
 
Copyright (c) 2000, 2011, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.01 sec)
 
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
23 rows in set (0.01 sec)
 
mysql> desc time_zone ;
+------------------+------------------+------+-----+---------+----------------+
| Field            | Type             | Null | Key | Default | Extra          |
+------------------+------------------+------+-----+---------+----------------+
| Time_zone_id     | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| Use_leap_seconds | enum('Y','N')    | NO   |     | N       |                |
+------------------+------------------+------+-----+---------+----------------+
mysql> quit
Bye
 
 
 

你可能感兴趣的:(yum安装MYSQ配置)