centos mysql 建库_[已解决]在CentOS中创建对应的mysql数据库

折腾:

期间,需要在CentOS中,创建好自己的数据库。

centos create mysql database(SIPEvents) ➜  SIPEvents netstat -tupln

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 0.0.0.0:10022               0.0.0.0:*                   LISTEN      17286/docker-proxy

tcp        0      0 0.0.0.0:9000                0.0.0.0:*                   LISTEN      19706/docker-proxy

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      17220/mysqld

tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      19659/redis-server

tcp        0      0 0.0.0.0:9003                0.0.0.0:*                   LISTEN      19669/docker-proxy

tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      16058/python

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      20416/nginx

tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1335/sshd

tcp        0      0 0.0.0.0:3000                0.0.0.0:*                   LISTEN      17240/docker-proxy

tcp        0      0 0.0.0.0:8088                0.0.0.0:*                   LISTEN      29962/docker-proxy

tcp        0      0 0.0.0.0:5432                0.0.0.0:*                   LISTEN      18421/docker-proxy

tcp        0      0 0.0.0.0:8000                0.0.0.0:*                   LISTEN      19505/docker-proxy

tcp        0      0 0.0.0.0:32771               0.0.0.0:*                   LISTEN      8748/docker-proxy

tcp        0      0 0.0.0.0:32772               0.0.0.0:*                   LISTEN      8782/docker-proxy

udp        0      0 192.168.42.1:123            0.0.0.0:*                               1346/ntpd

udp        0      0 115.29.173.126:123          0.0.0.0:*                               1346/ntpd

udp        0      0 10.161.170.247:123          0.0.0.0:*                               1346/ntpd

udp        0      0 127.0.0.1:123               0.0.0.0:*                               1346/ntpd

udp        0      0 0.0.0.0:123                 0.0.0.0:*                               1346/ntpd

->

后台有mysqld运行了

-》应该就是此处的CentOS中,已经安装了mysql的server了。

-》所以无需再去

yum install mysql-server

了。

且事实证明,此处已经安装了最新版的mysql的服务器了:(SIPEvents) ➜  SIPEvents yum install mysql-server

Loaded plugins: security

Setting up Install Process

base                                                                                                                                                            | 3.7 kB     00:00

centos-sclo-rh                                                                                                                                                  | 2.9 kB     00:00

elrepo                                                                                                                                                          | 2.9 kB     00:00

elrepo/primary_db                                                                                                                                               | 716 kB     00:12

epel                                                                                                                                                            | 4.3 kB     00:00

epel/primary_db                                                                                                                                                 | 5.9 MB     00:05

extras                                                                                                                                                          | 3.4 kB     00:00

updates                                                                                                                                                         | 3.4 kB     00:00

updates/primary_db                                                                                                                                              | 2.0 MB     00:01

Package mysql-server-5.1.73-7.el6.x86_64 already installed and latest version

Nothing to do

mysql-server-5.1.73(SIPEvents) ➜  SIPEvents mysql

mysql                       mysqlcheck                  mysqldump                   mysqlhotcopy                mysqlshow                   mysql_waitpid

mysqlaccess                 mysql_config                mysqldumpslow               mysqlimport                 mysqlslap                   mysql_zap

mysqladmin                  mysql_convert_table_format  mysql_find_rows             mysql_install_db            mysqltest

mysqlbinlog                 mysqld_multi                mysql_fix_extensions        mysql_secure_installation   mysql_tzinfo_to_sql

mysqlbug                    mysqld_safe                 mysql_fix_privilege_tables  mysql_setpermission         mysql_upgrade

然后去登录,结果出错:

然后去创建数据库:(SIPEvents) ➜  SIPEvents mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.1.73 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> show tables;

ERROR 1046 (3D000): No database selected

mysql> show databases;

+——————–+

| Database           |

+——————–+

| information_schema |

| gogs               |

| mysql              |

| test               |

+——————–+

4 rows in set (0.00 sec)

mysql> create datebase sipevents;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘datebase sipevents’ at line 1

mysql> create database sipevents;

Query OK, 1 row affected (0.00 sec)

mysql> use sipevents;

Database changed

mysql> show tables;

Empty set (0.00 sec)

mysql>

[总结]

去创建数据库,基本的步骤是:

1.登录mysqlmysql -u root -p

输入数据库的密码,回车,进入数据库

2.去创建数据库create database sipevents;

注:

1.查看当前有哪些数据库可以用:

show databases;

2.去看看新建的数据库中的表:use sipevents;

show tables;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值