Fedora28 安装mariadb及初始化
一、安装
sudo yum install mariadb* -y 将所有的mariadb相关的包全安装上。
二、启动
systemctl start mariadb 启动服务
ps aux | grep mysqld 查看是否运行
mysql 4243 0.0 2.2 2228644 87988 ? Ssl 06:04 0:00 /usr/libexec/mysqld --basedir=/usr
leo 5001 0.0 0.0 213788 1072 pts/1 S+ 06:30 0:00 grep --color=auto mysqld
三、进入数据库添加用户
su root
mysql -u root -p
不输入密码直接回车
[root@linux leo]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 10.2.14-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create user jack;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> select host,user,password from user;
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> 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
MariaDB [mysql]> select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | |
| linux | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| linux | | |
| % | jack | |
+-----------+------+----------+
7 rows in set (0.00 sec)
MariaDB [mysql]> update user set(password)='jackdb' where user='jack';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(password)='jackdb' where user='jack'' at line 1
MariaDB [mysql]> update user set password=password('jackdb') where user='jack';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [mysql]>
四、新建数据库
create database cbdb; 新建cbdb
use cbdb; 切换到cbdb