因此,我基本上是在我的mac上用mysql安装mariadb,使用的是自制的。以下是我所做的步骤:
运行mysql_upgrade后给出了以下错误:
版本检查失败。在调用“mysql”命令行客户端错误1698 (28000)时获得以下错误:用户'root'@'localhost‘的访问被拒绝,致命错误:升级失败
我不能像这样输入mysql:
mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)但像这样:
sudo mysql -u rootuser表返回以下内容:
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 User, Host, plugin FROM mysql.user;
+---------------+-------------------------+-----------------------+
| User | Host | plugin |
+---------------+-------------------------+-----------------------+
| root | localhost | mysql_native_password |
| toms | localhost | mysql_native_password |
| | localhost | |
| | toms-macbook-pro.local | |
+---------------+-------------------------+-----------------------+
4 rows in set (0.004 sec)发布于 2019-09-05 12:41:42
您可以尝试更新根密码,然后访问它。
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';退出Mysql并尝试登录
mysql -uroot -p # then use root as a password发布于 2021-07-24 16:29:23
有什么问题吗?
brew install mariadb@10.2安装brew install mariadb@10.2。- Method 1: `mysqld_safe` command - run command: `brew services stop mariadb@10.2`
- run command: `mysqld_safe --skip-grant-tables --skip-networking`
- on a new terminal tab, MariaDB <= 10.4:mysql_secure_installation运行命令
运行MariaDB >= 10.4 mariadb-secure-installation命令
在接下来的步骤中,
- this will ask to enter root password
- hit enter without entering any password (this step might never go away!)
- if empty root password is granted in previous step 输入并重新输入新密码。
-这可能会显示出一些错误,Password update failed!
- Method 2: `/usr/local/mysql/bin/mysqladmin -u root -p password` - this will ask to enter password
- hit enter without entering any password
- this will show some errors!,但前两种方法都不起作用!
brew services start mariadb@10.2- run `mysql.servert start`- this will show an error with error log file location- typical mariadb error file location: `/usr/local/var/mysql/<filename>.local.err`- run `tail -f /usr/local/var/mysql/<filename>.local.err`- then re-run `mysql.servert start`- there will be an error related to `Invalid flags lib`- run `brew services stop mariadb@10.2`- (**BACKUP, BACKUP, BACKUP YOUR DBS! THIS WILL DELETE ALL DBs!**) run sudo rm -rf /usr/local/var/mysql
- run mysql_install_db -详细--用户=whoami-basedir=“$(brew--前缀mariadb@10.2)”-datadir=“/usr/local/var/mysql”-tempdir=“/tmp”
这将从brew获得mariaDB单元安装路径,这将安装初始db。
- instead of running `mysql_secure_installation` or `mariadb-secure-installation` **run**: `sudo mysql -u root`- this will drop to mysql shell- enter command: `use mysql;`- enter command: `ALTER USER 'root@localhost' IDENTIFIED BY '<password>';` (replace the )- enter command: `ALTER USER 'root@127.0.0.1' IDENTIFIED BY '<password>';` (replace the )- enter command: `FLUSH PRIVILEGES;`- enter command: `exit`- now you can run `mysql -u root -p` and use the `<password>` entered in earlier step.就这样!
发布于 2019-09-05 12:29:37
默认情况下,MariaDB 10.4为本地根启用Unix插座身份验证插件。这意味着,在刚安装的系统上,只要您是本地根(例如,在sudo下运行),并且使用套接字而不是TCP,您就可以在没有密码的情况下连接到正在运行的服务器。
此外,MariaDB 10.4允许对帐户使用多个身份验证方法。它将本地根配置为也能够使用密码身份验证,但它最初使密码无效(不像以前那样设置空密码)。如果要使用密码身份验证并以mysql -uroot -p身份连接,则首先需要使用Unix作为根用户进行连接,然后运行SET PASSWORD=...。
高级用户配置现在以JSON格式存储在mysql.global_priv表中。mysql.user是为了向后兼容性而保留的,但它已经不再是一个表,而是一个视图。由于允许多个身份验证方法,它并不总是准确地显示用户配置。具体来说,它并不显示用户可用的所有身份验证方法,您需要查询mysql.global_priv。在新的安装中,您将看到以下内容
+-----------+--------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Host | User | Priv |
+-----------+--------+--------------------------------------------------------------------------------------------------------------------------------------------+
| localhost | root | {"access":18446744073709551615,"plugin":"mysql_native_password","authentication_string":"invalid","auth_or":[{},{"plugin":"unix_socket"}]} |
...您可以找到有关10.4身份验证更改这里的更多信息。
https://stackoverflow.com/questions/57803604
复制相似问题