mysql用户权限

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 277
Server version: 10.3.0-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)

MariaDB [(none)]> create  database kp;
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'kp'
MariaDB [(none)]> exit;
Bye
[root@localhost mysql]# service mysqld stop;
Redirecting to /bin/systemctl stop mysqld.service
[root@localhost mysql]# mysqld_safe --skip-grant-tables
171227 08:51:16 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
171227 08:51:16 mysqld_safe A mysqld process already exists
[root@localhost mysql]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost mysql]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost mysql]# ps -ef|grep mysql
root       643 32549  0 08:51 pts/1    00:00:00 mysql -u root -p
root       767   345  0 08:53 pts/2    00:00:00 grep --color=auto mysql
root     11181     1  0 12月26 ?      00:00:00 /bin/sh /usr/bin/mysqld_safe --user=mysql --skip-grant-tables --skip-networking
mysql    11262 11181  0 12月26 ?      00:00:06 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-tables --skip-networking --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=localhost.localdomain.pid
[root@localhost mysql]# kill -9 11181
[root@localhost mysql]# ls
aria_log.00000001  ib_logfile0                localhost.localdomain.pid  tc.log
aria_log_control   ib_logfile1                multi-master.info          test
database_name      ibtmp1                     mysql
ib_buffer_pool     keyperson                  mysql.sock
ibdata1            localhost.localdomain.err  performance_schema
[root@localhost mysql]# cd ..
[root@localhost lib]# ls
AccountsService  dirsrv        logrotate.status      pear       setroubleshoot
alsa             dnsmasq       machines              Pegasus    sss
alternatives     fprint        misc                  php        stateless
amanda           games         mlocate               pki        systemd
authconfig       gdm           mysql                 plymouth   tomcat
bluetooth        gssproxy      net-snmp              polkit-1   udisks2
certmonger       hsqldb        NetworkManager        postfix    unbound
chrony           hyperv        nfs                   pulse      upower
color            inital-setup  ntp                   rhsm       virtuoso
colord           initramfs     openlmi-registration  rpcbind    xkb
corosync         ipa           openlmi-storage       rpm        yum
cs               ipa-client    os-prober             rpm-state
dav              iscsi         pacemaker             rsyslog
dbus             libvirt       PackageKit            samba
dhclient         lldpad        pcsd                  selinux
[root@localhost lib]# yum remove mariadb
已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 MariaDB-client.x86_64.0.10.3.0-1.el7.centos 将被 删除
--> 正在处理依赖关系 MariaDB-client,它被软件包 MariaDB-server-10.3.0-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 MariaDB-server.x86_64.0.10.3.0-1.el7.centos 将被 删除
--> 解决依赖关系完成
base/7/x86_64                                            | 3.6 kB     00:00     
extras/7/x86_64                                          | 3.4 kB     00:00     
mariadb                                                  | 2.9 kB     00:00     
mysql-connectors-community/x86_64                        | 2.5 kB     00:00     
mysql-tools-community/x86_64                             | 2.5 kB     00:00     
mysql56-community/x86_64                                 | 2.5 kB     00:00     
updates/7/x86_64                                         | 3.4 kB     00:00     

依赖关系解决

================================================================================
 Package             架构        版本                       源             大小
================================================================================
正在删除:
 MariaDB-client      x86_64      10.3.0-1.el7.centos        @mariadb      210 M
为依赖而移除:
 MariaDB-server      x86_64      10.3.0-1.el7.centos        @mariadb      473 M

事务概要
================================================================================
移除  1 软件包 (+1 依赖软件包)

安装大小:683 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : MariaDB-server-10.3.0-1.el7.centos.x86_64                   1/2
  正在删除    : MariaDB-client-10.3.0-1.el7.centos.x86_64                   2/2
  验证中      : MariaDB-client-10.3.0-1.el7.centos.x86_64                   1/2
  验证中      : MariaDB-server-10.3.0-1.el7.centos.x86_64                   2/2

删除:
  MariaDB-client.x86_64 0:10.3.0-1.el7.centos                                   

作为依赖被删除:
  MariaDB-server.x86_64 0:10.3.0-1.el7.centos                                   

完毕!
[root@localhost lib]# yum remove mariadb-server
已加载插件:fastestmirror, langpacks
参数 mariadb-server 没有匹配
不删除任何软件包
[root@localhost lib]# yum remove mariadb-client
已加载插件:fastestmirror, langpacks
参数 mariadb-client 没有匹配
不删除任何软件包
[root@localhost lib]# mv mysql mysql_bak
[root@localhost lib]# ls
AccountsService  dirsrv        logrotate.status      pear       setroubleshoot
alsa             dnsmasq       machines              Pegasus    sss
alternatives     fprint        misc                  php        stateless
amanda           games         mlocate               pki        systemd
authconfig       gdm           mysql_bak             plymouth   tomcat
bluetooth        gssproxy      net-snmp              polkit-1   udisks2
certmonger       hsqldb        NetworkManager        postfix    unbound
chrony           hyperv        nfs                   pulse      upower
color            inital-setup  ntp                   rhsm       virtuoso
colord           initramfs     openlmi-registration  rpcbind    xkb
corosync         ipa           openlmi-storage       rpm        yum
cs               ipa-client    os-prober             rpm-state
dav              iscsi         pacemaker             rsyslog
dbus             libvirt       PackageKit            samba
dhclient         lldpad        pcsd                  selinux
[root@localhost lib]# cd mysql
-bash: cd: mysql: 没有那个文件或目录
[root@localhost lib]# mysql
-bash: /usr/bin/mysql: 没有那个文件或目录
[root@localhost lib]# yum install mariadb
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 mariadb 已经被 MariaDB-client 取代,改为尝试安装 MariaDB-client-10.3.0-1.el7.centos.x86_64
正在解决依赖关系
--> 正在检查事务
---> 软件包 MariaDB-client.x86_64.0.10.3.0-1.el7.centos 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================
 Package             架构        版本                        源            大小
================================================================================
正在安装:
 MariaDB-client      x86_64      10.3.0-1.el7.centos         mariadb       50 M

事务概要
================================================================================
安装  1 软件包

总下载量:50 M
安装大小:210 M
Is this ok [y/d/N]: y
Downloading packages:
MariaDB-10.3.0-centos7-x86_64-client.rpm                   |  50 MB   01:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : MariaDB-client-10.3.0-1.el7.centos.x86_64                   1/1
  验证中      : MariaDB-client-10.3.0-1.el7.centos.x86_64                   1/1

已安装:
  MariaDB-client.x86_64 0:10.3.0-1.el7.centos                                   

完毕!
[root@localhost lib]# yum install mariadb-server
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 mariadb-server 已经被 MariaDB-server 取代,改为尝试安装 MariaDB-server-10.3.0-1.el7.centos.x86_64
正在解决依赖关系
--> 正在检查事务
---> 软件包 MariaDB-server.x86_64.0.10.3.0-1.el7.centos 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================
 Package             架构        版本                        源            大小
================================================================================
正在安装:
 MariaDB-server      x86_64      10.3.0-1.el7.centos         mariadb      113 M

事务概要
================================================================================
安装  1 软件包

总下载量:113 M
安装大小:473 M
Is this ok [y/d/N]: y
Downloading packages:
MariaDB-10.3.0-centos7-x86_64-server.rpm                   | 113 MB   06:56     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : MariaDB-server-10.3.0-1.el7.centos.x86_64                   1/1
chown: 无法访问"/var/lib/mysql": 没有那个文件或目录

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB 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 localhost.localdomain 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 MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

  验证中      : MariaDB-server-10.3.0-1.el7.centos.x86_64                   1/1

已安装:
  MariaDB-server.x86_64 0:10.3.0-1.el7.centos                                   

完毕!
[root@localhost lib]# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@localhost lib]# ll
总用量 28
drwxr-xr-x. 4 root         root       30 12月 26 19:15 AccountsService
drwxr-xr-x. 2 root         root       30 12月 26 20:01 alsa
drwxr-xr-x. 2 root         root     4096 12月 26 16:30 alternatives
drwxr-xr-x. 4 amandabackup disk       58 12月 26 19:30 amanda
drwx------. 3 root         root       17 12月 26 19:37 authconfig
drwxr-xr-x. 2 root         root        6 6月  10 2014 bluetooth
drwxr-xr-x. 4 root         root       31 12月 26 19:17 certmonger
drwxr-xr-x. 2 chrony       chrony     18 12月 27 08:21 chrony
drwxr-xr-x. 3 root         root       16 12月 26 19:17 color
drwxr-xr-x. 3 colord       colord     50 12月 26 20:02 colord
drwxr-xr-x. 2 root         root        6 6月  10 2014 corosync
drwxr-xr-x. 2 root         root        6 6月  10 2014 cs
drwx------. 2 apache       apache      6 6月  18 2014 dav
drwxr-xr-x. 2 root         root        6 6月  10 2014 dbus
drwxr-xr-x. 2 root         root        6 12月 26 20:01 dhclient
drwxr-xr-x. 2 root         root        6 6月  10 2014 dirsrv
drwxr-xr-x. 2 root         root        6 6月  10 2014 dnsmasq
drwxr-xr-x. 2 root         root        6 6月  10 2014 fprint
drwxr-xr-x. 2 root         root        6 6月  10 2014 games
drwxrwx--T. 3 gdm          gdm        19 12月 26 19:27 gdm
drwxr-xr-x. 3 root         root       20 12月 26 19:29 gssproxy
drwxr-xr-x. 4 root         root       95 12月 26 19:23 hsqldb
drwxr-xr-x. 2 root         root        6 6月  10 2014 hyperv
drwxr-xr-x. 2 root         root       27 12月 26 19:37 inital-setup
drwxr-xr-x. 2 root         root        6 8月   5 23:02 initramfs
drwxr-xr-x. 5 root         root       53 12月 26 19:28 ipa
drwxr-xr-x. 3 root         root       23 12月 26 19:21 ipa-client
drwxr-xr-x. 8 root         root       84 12月 26 19:15 iscsi
drwxr-xr-x. 9 root         root       97 12月 26 19:18 libvirt
drwxr-xr-x. 2 root         root        6 6月  10 2014 lldpad
-rw-r--r--. 1 root         root     1316 12月 27 03:36 logrotate.status
drwx------. 2 root         root        6 12月 26 17:38 machines
drwxr-xr-x. 2 root         root        6 12月 26 16:26 misc
drwxr-x---. 2 root         slocate    23 12月 27 03:36 mlocate
drwxr-xr-x. 5 mysql        mysql    4096 12月 27 09:04 mysql
drwxr-xr-x. 7 mysql        mysql    4096 12月 26 19:30 mysql_bak
drwxr-xr-x. 4 root         root       43 12月 26 19:14 net-snmp
drwxr-xr-x. 2 root         root     4096 12月 26 12:52 NetworkManager
drwxr-xr-x. 5 root         root       98 12月 26 19:18 nfs
drwxr-xr-x. 2 ntp          ntp         6 6月  19 2014 ntp
drwxr-xr-x. 4 root         root       45 12月 26 19:30 openlmi-registration
drwxr-xr-x. 2 root         root        6 6月  10 2014 openlmi-storage
drwxr-xr-x. 2 root         root        6 6月  10 2014 os-prober
drwxr-x---. 6 hacluster    haclient   57 12月 26 19:16 pacemaker
drwxr-xr-x. 2 root         root       73 12月 27 08:52 PackageKit
drwx------. 2 root         root        6 6月  10 2014 pcsd
drwxr-xr-x. 5 root         root     4096 12月 26 15:35 pear
drwxr-x---. 5 root         pegasus    45 12月 26 19:16 Pegasus
drwxr-xr-x. 3 root         root       20 12月 26 13:59 php
drwxr-xr-x. 2 root         root        6 6月  10 2014 pki
drwxr-xr-x. 2 root         root       26 12月 26 19:20 plymouth
drwxr-x---. 3 root         polkitd    27 12月 26 19:15 polkit-1
drwx------. 2 postfix      root       24 12月 26 20:02 postfix
drwx------. 2 pulse        pulse       6 6月  10 2014 pulse
drwxr-xr-x. 2 root         root       25 12月 26 19:35 rhsm
drwx------. 2 rpc          rpc         6 6月  10 2014 rpcbind
drwxr-xr-x. 2 root         root     4096 12月 26 11:54 rpm
drwxr-xr-x. 3 root         root       18 12月 26 19:15 rpm-state
drwx------. 2 root         root        6 6月  10 2014 rsyslog
drwxr-xr-x. 3 root         root       20 12月 26 19:17 samba
drwxr-xr-x. 2 root         root        6 6月  10 2014 selinux
drwxr-xr-x. 2 root         root       69 12月 26 15:29 setroubleshoot
drwxr-xr-x. 6 root         root       50 12月 26 19:20 sss
drwxr-xr-x. 4 root         root       33 8月   4 07:57 stateless
drwxr-xr-x. 4 root         root       53 10月 20 11:07 systemd
drwxr-xr-x. 3 root         tomcat     20 12月 26 19:24 tomcat
drwx------. 2 root         root        6 6月  10 2014 udisks2
drwxr-xr-x. 2 unbound      unbound    21 12月 26 19:17 unbound
drwxr-xr-x. 2 root         root        6 6月  10 2014 upower
drwxr-xr-x. 3 root         root       15 12月 26 19:17 virtuoso
drwxr-xr-x. 2 root         root       28 12月 26 12:06 xkb
drwxr-xr-x. 6 root         root       75 12月 27 09:05 yum
[root@localhost lib]# cd mysql
[root@localhost mysql]# ll
总用量 110620
-rw-rw----. 1 mysql mysql    16384 12月 27 09:04 aria_log.00000001
-rw-rw----. 1 mysql mysql       52 12月 27 09:04 aria_log_control
-rw-rw----. 1 mysql mysql     2795 12月 27 09:04 ib_buffer_pool
-rw-rw----. 1 mysql mysql 12582912 12月 27 09:04 ibdata1
-rw-rw----. 1 mysql mysql 50331648 12月 27 09:04 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 12月 27 09:04 ib_logfile1
drwx--x--x. 2 mysql mysql     4096 12月 27 09:04 mysql
drwx------. 2 mysql mysql       19 12月 27 09:04 performance_schema
drwxr-xr-x. 2 mysql mysql        6 12月 27 09:04 test
[root@localhost mysql]# cd ..
[root@localhost lib]# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@localhost lib]# ll
总用量 28
drwxr-xr-x. 4 root         root       30 12月 26 19:15 AccountsService
drwxr-xr-x. 2 root         root       30 12月 26 20:01 alsa
drwxr-xr-x. 2 root         root     4096 12月 26 16:30 alternatives
drwxr-xr-x. 4 amandabackup disk       58 12月 26 19:30 amanda
drwx------. 3 root         root       17 12月 26 19:37 authconfig
drwxr-xr-x. 2 root         root        6 6月  10 2014 bluetooth
drwxr-xr-x. 4 root         root       31 12月 26 19:17 certmonger
drwxr-xr-x. 2 chrony       chrony     18 12月 27 08:21 chrony
drwxr-xr-x. 3 root         root       16 12月 26 19:17 color
drwxr-xr-x. 3 colord       colord     50 12月 26 20:02 colord
drwxr-xr-x. 2 root         root        6 6月  10 2014 corosync
drwxr-xr-x. 2 root         root        6 6月  10 2014 cs
drwx------. 2 apache       apache      6 6月  18 2014 dav
drwxr-xr-x. 2 root         root        6 6月  10 2014 dbus
drwxr-xr-x. 2 root         root        6 12月 26 20:01 dhclient
drwxr-xr-x. 2 root         root        6 6月  10 2014 dirsrv
drwxr-xr-x. 2 root         root        6 6月  10 2014 dnsmasq
drwxr-xr-x. 2 root         root        6 6月  10 2014 fprint
drwxr-xr-x. 2 root         root        6 6月  10 2014 games
drwxrwx--T. 3 gdm          gdm        19 12月 26 19:27 gdm
drwxr-xr-x. 3 root         root       20 12月 26 19:29 gssproxy
drwxr-xr-x. 4 root         root       95 12月 26 19:23 hsqldb
drwxr-xr-x. 2 root         root        6 6月  10 2014 hyperv
drwxr-xr-x. 2 root         root       27 12月 26 19:37 inital-setup
drwxr-xr-x. 2 root         root        6 8月   5 23:02 initramfs
drwxr-xr-x. 5 root         root       53 12月 26 19:28 ipa
drwxr-xr-x. 3 root         root       23 12月 26 19:21 ipa-client
drwxr-xr-x. 8 root         root       84 12月 26 19:15 iscsi
drwxr-xr-x. 9 root         root       97 12月 26 19:18 libvirt
drwxr-xr-x. 2 root         root        6 6月  10 2014 lldpad
-rw-r--r--. 1 root         root     1316 12月 27 03:36 logrotate.status
drwx------. 2 root         root        6 12月 26 17:38 machines
drwxr-xr-x. 2 root         root        6 12月 26 16:26 misc
drwxr-x---. 2 root         slocate    23 12月 27 03:36 mlocate
drwxr-xr-x. 5 mysql        mysql    4096 12月 27 09:04 mysql
drwxr-xr-x. 7 mysql        mysql    4096 12月 26 19:30 mysql_bak
drwxr-xr-x. 4 root         root       43 12月 26 19:14 net-snmp
drwxr-xr-x. 2 root         root     4096 12月 26 12:52 NetworkManager
drwxr-xr-x. 5 root         root       98 12月 26 19:18 nfs
drwxr-xr-x. 2 ntp          ntp         6 6月  19 2014 ntp
drwxr-xr-x. 4 root         root       45 12月 26 19:30 openlmi-registration
drwxr-xr-x. 2 root         root        6 6月  10 2014 openlmi-storage
drwxr-xr-x. 2 root         root        6 6月  10 2014 os-prober
drwxr-x---. 6 hacluster    haclient   57 12月 26 19:16 pacemaker
drwxr-xr-x. 2 root         root       73 12月 27 08:52 PackageKit
drwx------. 2 root         root        6 6月  10 2014 pcsd
drwxr-xr-x. 5 root         root     4096 12月 26 15:35 pear
drwxr-x---. 5 root         pegasus    45 12月 26 19:16 Pegasus
drwxr-xr-x. 3 root         root       20 12月 26 13:59 php
drwxr-xr-x. 2 root         root        6 6月  10 2014 pki
drwxr-xr-x. 2 root         root       26 12月 26 19:20 plymouth
drwxr-x---. 3 root         polkitd    27 12月 26 19:15 polkit-1
drwx------. 2 postfix      root       24 12月 26 20:02 postfix
drwx------. 2 pulse        pulse       6 6月  10 2014 pulse
drwxr-xr-x. 2 root         root       25 12月 26 19:35 rhsm
drwx------. 2 rpc          rpc         6 6月  10 2014 rpcbind
drwxr-xr-x. 2 root         root     4096 12月 26 11:54 rpm
drwxr-xr-x. 3 root         root       18 12月 26 19:15 rpm-state
drwx------. 2 root         root        6 6月  10 2014 rsyslog
drwxr-xr-x. 3 root         root       20 12月 26 19:17 samba
drwxr-xr-x. 2 root         root        6 6月  10 2014 selinux
drwxr-xr-x. 2 root         root       69 12月 26 15:29 setroubleshoot
drwxr-xr-x. 6 root         root       50 12月 26 19:20 sss
drwxr-xr-x. 4 root         root       33 8月   4 07:57 stateless
drwxr-xr-x. 4 root         root       53 10月 20 11:07 systemd
drwxr-xr-x. 3 root         tomcat     20 12月 26 19:24 tomcat
drwx------. 2 root         root        6 6月  10 2014 udisks2
drwxr-xr-x. 2 unbound      unbound    21 12月 26 19:17 unbound
drwxr-xr-x. 2 root         root        6 6月  10 2014 upower
drwxr-xr-x. 3 root         root       15 12月 26 19:17 virtuoso
drwxr-xr-x. 2 root         root       28 12月 26 12:06 xkb
drwxr-xr-x. 6 root         root       75 12月 27 09:05 yum
[root@localhost lib]# ^C
[root@localhost lib]# mysql_bak
bash: mysql_bak: 未找到命令...
[root@localhost lib]# cd mysql_bak
[root@localhost mysql_bak]# ll
总用量 129136
-rw-rw----. 1 mysql mysql    16384 12月 26 19:16 aria_log.00000001
-rw-rw----. 1 mysql mysql       52 12月 26 19:16 aria_log_control
drwx------. 2 mysql mysql       19 12月 26 19:19 database_name
-rw-rw----. 1 mysql mysql     2752 12月 26 19:16 ib_buffer_pool
-rw-rw----. 1 mysql mysql 18874368 12月 26 19:23 ibdata1
-rw-rw----. 1 mysql mysql 50331648 12月 26 19:23 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 12月 26 17:42 ib_logfile1
-rw-rw----. 1 mysql mysql 12582912 12月 26 19:16 ibtmp1
drwx------. 2 mysql mysql     4096 12月 26 19:23 keyperson
-rw-rw----. 1 mysql mysql    46555 12月 27 08:52 localhost.localdomain.err
-rw-rw----. 1 mysql mysql        6 12月 26 19:16 localhost.localdomain.pid
-rw-rw----. 1 mysql mysql        0 12月 26 17:42 multi-master.info
drwx------. 2 mysql mysql     4096 12月 26 13:30 mysql
srwxrwxrwx. 1 mysql mysql        0 12月 26 19:16 mysql.sock
drwx------. 2 mysql mysql     4096 12月 26 13:30 performance_schema
-rw-rw----. 1 mysql mysql    24576 12月 26 19:16 tc.log
drwx------. 2 mysql mysql        6 12月 26 13:30 test
[root@localhost mysql_bak]# cp -r mysql.sock /var/lib/mysql
[root@localhost mysql_bak]# cd /var/lib/mysql
[root@localhost mysql]# ll
总用量 110620
-rw-rw----. 1 mysql mysql    16384 12月 27 09:04 aria_log.00000001
-rw-rw----. 1 mysql mysql       52 12月 27 09:04 aria_log_control
-rw-rw----. 1 mysql mysql     2795 12月 27 09:04 ib_buffer_pool
-rw-rw----. 1 mysql mysql 12582912 12月 27 09:04 ibdata1
-rw-rw----. 1 mysql mysql 50331648 12月 27 09:04 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 12月 27 09:04 ib_logfile1
drwx--x--x. 2 mysql mysql     4096 12月 27 09:04 mysql
srwxr-xr-x. 1 root  root         0 12月 27 09:14 mysql.sock
drwx------. 2 mysql mysql       19 12月 27 09:04 performance_schema
drwxr-xr-x. 2 mysql mysql        6 12月 27 09:04 test
[root@localhost mysql]# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
[root@localhost mysql]# systemctl mysql start;
Unknown operation 'mysql'.
[root@localhost mysql]# systemctl start mariadb;
[root@localhost mysql]# systemctl status mariadb;
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since 三 2017-12-27 09:15:41 CST; 8s ago
  Process: 1684 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 1604 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 1590 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 1623 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─1623 /usr/sbin/mysqld

12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: 2017-12-27  9:15:41 140...
12月 27 09:15:41 localhost.localdomain mysqld[1623]: Version: '10.3.0-MariaD...
12月 27 09:15:41 localhost.localdomain systemd[1]: Started MariaDB database ...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.0-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database aa;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]>

posted @ 2017-12-27 09:19  ComeComeGo  阅读(244)  评论(0编辑  收藏  举报