Linux下用rpm方式安裝MySQL
1、MySQL下載地址。
www.mysql.com/downloads/mysql-4.0.html
下載MySQL 5.1版本的2個包(根據你的實際需求下載所需要的包):
MySQL-server-community-5.1.68-1.rhel5.i386.rpm
MySQL-client-community-5.1.68-1.rhel5.i386.rpm
2、安裝server和client安裝包。
[root@serv22 mnt]# rpm -ivh MySQL-server-community-5.1.68-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]
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 serv22 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.
Please report any problems with the /usr/bin/mysqlbug script!
Starting MySQL..[ OK ]
Giving mysqld 2 seconds to start
[root@serv22 mnt]# rpm -ivh MySQL-client-community-5.1.68-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]
3、安裝完後直接執行 “mysql” 命令登陸資料庫,看是否安裝成功。
[root@serv22 mnt]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.68-community MySQL Community Server (GPL)
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>
如果出現以上提示,說明安裝成功。
4、檢視有哪些資料庫,系統會預設安裝幾個資料庫。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
使用mysql資料庫
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.00 sec)
檢視錶的結構,比如user表。
mysql> desc user;
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(16) | NO | PRI | | |
| Password | char(41) | NO | | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv |enum('N','Y') |NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| ssl_type |enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) unsigned | NO | | 0 | |
+-----------------------+-----------------------------------+------+-----+---------+-------+
39 rows in set (0.01 sec)
檢視user表中的資料
mysql> select host,user from user;
+-----------+------+
| host
| user |
+-----------+------+
| 127.0.0.1 | root |
| localhost | |
| localhost | root |
| serv22 | |
| serv22 | root |
+-----------+------+
5 rows in set (0.00 sec)
--修改root使用者的密碼
格式:mysqladmin -u使用者名稱 -p舊密碼 password 新密碼
[root@serv22 mnt]# mysqladmin -uroot password mysql123
再次嘗試不加密碼登陸資料庫,會出現報錯資訊
[root@serv22 mnt]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
使用密碼登陸資料庫
格式:mysql [-u username] [-h host] [-p[password]] [dbname]
[root@serv22 mnt]# mysql -uroot -pmysql123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.68-community MySQL Community Server (GPL)
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>
登陸成功。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27633655/viewspace-1092190/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 在Linux(Redhat/CentOS)下安裝MySQL之yum(rpm)線上安裝方式LinuxRedhatCentOSMySql
- 在Linux(Redhat/CentOS)下安裝MySQL之yum(rpm)離線安裝方式LinuxRedhatCentOSMySql
- MySQL 5.7.22 rpm 安裝方式MySql
- Mysql for Linux安裝配置之—— rpm(bundle)安裝MySqlLinux
- Linux系統下安裝配置JDK(rpm方式及tar.gz方式)LinuxJDK
- CentOS下使用rpm包安裝MySQLCentOSMySql
- mysql安裝(rpm)MySql
- CentOS安裝MySQL的兩種方式——RPM和YUMCentOSMySql
- Linux rpm -e --nodeps rpm解除安裝Linux
- 基於Linux的MySQL5.7RPM包安裝LinuxMySql
- clickhouse-backup(RPM方式安裝)
- rpm方式離線安裝ansible
- rpm方式安裝redis4.0Redis
- mysql linux下安裝MySqlLinux
- Linux下Centos7以rpm方式離線安裝MySQL5.7教程以及部分報錯解決方案LinuxCentOSMySql
- CentOS 下 MySQL 5.6 基於 RPM 的下載、安裝、配置CentOSMySql
- 【MySQL安裝】Linux下安裝MySQL(預編譯)MySqlLinux編譯
- Linux命令之rpm安裝命令Linux
- Linux 下 docker 安裝 MySQLLinuxDockerMySql
- Linux下安裝使用MySQLLinuxMySql
- Linux下安裝MySQL 5.7LinuxMySql
- 【mysql】linux下安裝mysql-5.7.31MySqlLinux
- centos(linux): rpm -V 驗證rpm包安裝程式的安全CentOSLinux
- centos以RPM包方式安裝redis的方法CentOSRedis
- CentOS8 安裝 MySQL8.0(RPM)CentOSMySql
- mysql8.0.30的RPM包安裝方法MySql
- CentOS 6.7下yum方式安裝MySQL 5.6CentOSMySql
- Linux RPM包安裝、解除安裝、升級命令講解Linux
- Linux下安裝Mysql資料庫LinuxMySql資料庫
- MySQL - 下載與安裝配置(Linux)MySqlLinux
- MySQL-01.Linux下MySQL安裝和使用MySqlLinux
- mac下用brew安裝 mysqlMacMySql
- CentOS7離線安裝(rpm安裝)mysql資料庫CentOSMySql資料庫
- Linux系統下載mysql與安裝LinuxMySql
- 實踐:Linux下安裝mysql8.0LinuxMySql
- Linux下Mysql5.7.19解除安裝方法LinuxMySql
- Linux安裝解除安裝MySQLLinuxMySql
- yum如何解除安裝已安裝的rpm並安裝本地rpm包
- mysql安裝 for LinuxMySqlLinux