Mac 上安装 mariadb

Mac 上安装 mariadb

参考: https://mariadb.com/kb/en/mariadb/installing-mariadb-on-macos-using-homebrew/

brew install mariadb
结果
==> Using the sandbox
==> /usr/local/Cellar/mariadb/10.1.21/bin/mysql_install_db –verbose –user=lxxu
==> Caveats
A “/etc/my.cnf” from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
mysql -uroot

To have launchd start mariadb now and restart at login:
brew services start mariadb
Or, if you don’t want/need a background service you can just run:
mysql.server start
==> Summary
�� /usr/local/Cellar/mariadb/10.1.21: 576 files, 139.9M

参考: 关于卸载 mysql 后安装 mariadb https://gist.github.com/brandonsimpson/5204ce8a46f7a20071b5

mysql.server start
mysql -uroot -proot

GRANT ALL PRIVILEGES ON . TO ‘admin’@’localhost’ IDENTIFIED BY ‘admin’ with grant option;


root root;
admin admin; @localhost
xulx92 xulx92;

GRANT ALL PRIVILEGES ON cnblogsdb.* TO ‘xulx92’@’%’ IDENTIFIED BY ‘xulx92’ with grant option;

  1. Create the database
create database db_name;
  2. Create the username for the database db_name
grant all privileges on db_name.* to ‘username’@’localhost’ identified by ‘password’;
  3. Use the database
use db_name;
  4. Finally you are in database db_name and then execute the commands like create , select and insert operations.

若要分配一个不限制域名的用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON . TO ‘root’@’192.168.100.%’ IDENTIFIED BY ‘my-new-password’ WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON mydb.* TO ‘myuser’@’%’ WITH GRANT OPTION;
This is how I create my “Super User” privileges (although I would normally specify a host).

IMPORTANT NOTE While this answer can solve the problem of access, WITH GRANT OPTION creates a MySQL user that can edit the permissions
of other users.

The GRANT OPTION privilege enables you to give to other users or remove from other users those privileges that you yourself possess.
For security reasons, you should not use this type of user account for
any process that the public will have access to (i.e. a website). It
is recommended that you create a user with only database privileges
for that kind of use.

你可能感兴趣的:(软件安装,linux)