English 中文(简体)
b 装在马库西安装板
原标题:brew install mysql on macOS

I m 试图通过<代码>brew 安装我的sql 5.1.52,在Mac os 10.6上安装MySQL。

Everything goes well and I am also successful with the mysql_install_db.
However when I try to connect to the server using:

/usr/local/Cellar/mysql/5.1.52/bin/mysqladmin -u root password  mypass 

我收到了:

/usr/local/Cellar/mysql/5.1.52/bin/mysqladmin: connect to server at  localhost  
failed error:  Access denied for user  root @ localhost  (using password: NO) 

I ve tried to access mysqladmin or mysql using -u root -proot as well,
but it doesn t work with or without password.

这是一家品牌新机器上的新安装,只要我知道新的安装工作,就不必一根根本密码即可进入。 我还努力:

/usr/local/Cellar/mysql/5.1.52/bin/mysql_secure_installation

但我也这样做。

ERROR 1045 (28000): Access denied for user  root @ localhost  (using password: NO)
最佳回答

我认为,随着已经安装了旧的神秘面纱,我可以结束这一职务。 我也存在同样的问题,上述解决办法都没有对我有效。 因此,我确定:

旧布rew s remove &cleanup directs, unloaded the startctlscript, 然后删除了/usr/ local/var上的我的舱位。 (如果适用的话,可向您提出)和启动名单

Updated the string for the plist. Note also your alternate security script directory will be based on which version of MySQL you are installing.

逐步:

brew remove mysql

brew cleanup

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

sudo rm -rf /usr/local/var/mysql

I then started from scratch:

  1. installed mysql with brew install mysql
  2. 指挥员建议:

    unset TMPDIR
    
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
    
  3. 开始我sql与mysql.server 开始的指挥,以便能够登录在上。

  4. 替代安全说明:

    /usr/local/Cellar/mysql/5.5.10/bin/mysql_secure_installation
    
  5. 跟踪<代码> 射线 栏目。

    #start
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    
    #stop
    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    

< Note: the -force bit on brew Cleanup will also Cleanup original kegs, consider it s a new-ish homebrew norm.

www.un.org/Depts/DGACM/index_spanish.htm 注释二: 评论员说,不需要第2步。 我不想对此进行测试,因此,YMMV!

问题回答

这里有详细的指令,把所有MySQL从你的Ma分离出去,然后安装“Brew Way”,Sedorner写道:

Remove MySQL completely per The Tech Lab

  • ps -ax | grep mysql
  • stop and kill any MySQL processes
  • sudo rm /usr/local/mysql
  • sudo rm -rf /usr/local/var/mysql
  • sudo rm -rf /usr/local/mysql*
  • sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • rm -rf ~/Library/PreferencePanes/My*
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*
  • sudo rm -rf /private/var/db/receipts/*mysql*
  • sudo rm -rf /tmp/mysql*
  • try to run mysql, it shouldn t work

Brew install MySQL per user Sedorner from this StackOverflow answer

  • brew doctor and fix any errors

  • <条码>删除了我的sql。

  • <条码> 显示器件

  • www.un.org/Depts/DGACM/index_spanish.htm TMPDIR

      mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp # whoami is executed inline
    
  • http://www.un.org/Depts/DGACM/index_spanish.htm

  • 指挥 Brew建议,将MySQL添加到-startctl 因此,在启动时自动发射

现在应当工作并按预期运行所有时间

Godspeed。

问题相同。 如同所制定的指示或初步表格一样,有些错误。 这就是我如何用我的机器 running。

如果我的焊服务器已经运行在你的Mac上,则首先停止使用:

开始使用我的焊服务器,由以下指挥,允许任何人在完全许可的情况下投射。

www.un.org/Depts/DGACM/index_spanish.htm

然后,mysql -u fundamental, 如今,这应当让你在没有密码的情况下成功登录。 以下指挥机构应当重新确定所有根本密码。

UPDATE mysql.user SET Password=PASSWORD( NewPassword ) WHERE User= root ; FLUSH PRIVILEGES;

现在,如果你杀掉我的手脚印——安全,又不采用斯基普-快乐选择,就重新开张,那么你就应该能够用<条码>米斯喀尔-乌根——p和你刚才确定的新密码。

If brew installed MySQL 5.7, the process is a bit different than for previous versions. In order to reset the root password, proceed as follows:

sudo rm -rf /usr/local/var/mysql
mysqld --initialize

临时密码将刊印在议会,只能用于更新基本密码:

mysql.server start
echo "ALTER USER  root @ localhost  IDENTIFIED BY  my-new-password ;" | mysql -uroot --password=TEMPORARY_PASSWORD

Homebrew

  1. First, make sure you have homebrew installed
  2. Run brew doctor and address anything homebrew wants you to fix
  3. Run brew install mysql
  4. Run brew services restart mysql
  5. Run mysql.server start
  6. Run mysql_secure_installation

奥凯,我有同样的问题并解决了这个问题。 出于某种原因,我的手工艺品——安全——内装书写文字在使用家用燃烧器安装神秘面具时在盒子外工作,因此我是人工操作的。 http://www.ohchr.org。

mysql -u root

这应当使你陷入我的.。 现在做以下工作(摘自我sql_secure_installation):

UPDATE mysql.user SET Password=PASSWORD( your_new_pass ) WHERE User= root ;
DELETE FROM mysql.user WHERE User= root  AND Host NOT IN ( localhost ,  127.0.0.1 ,  ::1 );
DELETE FROM mysql.user WHERE User=  ;
DELETE FROM mysql.db WHERE Db= test  OR Db= test\_% 
DROP DATABASE test;
FLUSH PRIVILEGES;

如今已经离开,回到我的桌子上:mysql -u fundamental -p

我现在也存在同样的问题。 如果你<代码>brew info mysql,并遵循它所认为的根本密码,那么如果我正确记住的话,就应当有<代码>新密码<>。 我看到你看到的同样情况:。 第条帮助我最多。

它拒绝了我为我创建的任何<><>><>>>账户。 当我在操作<条码>后打字时,我没有再接过任何电线。 我以<代码>mysqld_safe开启了MySQLWorkbench,并添加了“代码>root

If mysql is already installed

完全停止我s。

  1. mysql.server stop <-- may need editing based on your version
  2. ps -ef | grep mysql <-- lists processes with mysql in their name
  3. kill [PID] <-- kill the processes by PID

移除档案。 上述指示是好的。 页: 1

  1. sudo find /. -name "*mysql*"
  2. Using your judgement, rm -rf these files. Note that many programs have drivers for mysql which you do not want to remove. For example, don t delete stuff in a PHP install s directory. Do remove stuff in its own mysql directory.

Install

希望你们有回家。 否则下载。

我现在要说一 root,但我不认为你必须。 Edit2018:你可以 t起rew子,再生根。

  1. sudo brew update
  2. sudo brew install cmake <-- dependency for mysql, useful
  3. sudo brew install openssl <-- dependency for mysql, useful
  4. sudo brew info mysql <-- skim through this... it gives you some idea of what s coming next
  5. sudo brew install mysql --with-embedded; say done <-- Installs mysql with the embedded server. Tells you when it finishes (my install took 10 minutes)

Afterwards

  1. sudo chown -R mysql /usr/local/var/mysql/ <-- mysql wouldn t work for me until I ran this command
  2. sudo mysql.server start <-- once again, the exact syntax may vary
  3. Create users in mysql (http://dev.mysql.com/doc/refman/5.7/en/create-user.html). Remember to add a password for the root user.

<<>strong>TL;DR

MySQL服务器安装后可能无法运行。 履历 如果你不希望我的SQL作为背景服务。

<>完整>

我刚刚安装了MySQL(表)5.7.17,涉及一个新的MacBook Pro的运行,在操作<密码>时也出现错误。

Securing the MySQL server deployment.

Enter password for user root: 
Error: Can t connect to local MySQL server through socket  /tmp/mysql.sock  (2)

Say what?

根据Brew的安装信息,mysql_secure_installation 请让我......确保安装。 我看到MySQL服务器可能无法运行,这是正确的。 滚动式<条码>brew服务从我的sql开始,然后mysql_secure_installation<>/code>与一个药店一样工作。

这里是MySQL5.7的最新情况。

bash --version
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin17.0.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

#========================================
brew --version
Homebrew 1.7.6
Homebrew/homebrew-core (git revision eeb08; last commit 2018-09-27)
Homebrew/homebrew-cask (git revision c9f62; last commit 2018-09-27)

#========================================
mysql --version
mysql  Ver 14.14 Distrib 5.7.23, for osx10.13 (x86_64) using  EditLine wrapper

#========================================
system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.13.3 (17D47)
      Kernel Version: Darwin 17.4.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: EdisonMacHomeBj
      User Name: Edison (edison)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Disabled
      Time since boot: 6 days 23:13
brew remove mysql@5.7
brew cleanup
mv /usr/local/var/mysql /usr/local/var/mysql.bak
brew install mysql@5.7
rm -rf /usr/local/var/mysql

#========================================
mysqld --initialize
2018-09-28T04:54:06.526061Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-09-28T04:54:06.542625Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-09-28T04:54:07.096637Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-09-28T04:54:07.132950Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-09-28T04:54:07.196824Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 87cf2f10-c2da-11e8-ac2d-ba163df10130.
2018-09-28T04:54:07.224871Z 0 [Warning] Gtid table is not ready to be used. Table  mysql.gtid_executed  cannot be opened.
2018-09-28T04:54:07.366688Z 0 [Warning] CA certificate ca.pem is self signed.
2018-09-28T04:54:07.457954Z 1 [Note] A temporary password is generated for root@localhost: kq3K=JR8;GqZ

#========================================
mysql_secure_installation -uroot -p"kq3K=JR8;GqZ"
mysql_secure_installation: [Warning] Using a password on the command line interface can be insecure.

Securing the MySQL server deployment.


The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new password:

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: n
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password:

Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
 localhost . This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named  test  that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

仅补充以前的答复——在从MySql 5.6升级到MySql 8.0时,我沿用了在此采取的步骤,使清理工作无所不在,然而,我接着错过错误。

2019-11-05T07:57:31.359304Z 0 [ERROR] [MY-000077] [Server] /usr/local/Cellar/mysql/8.0.18/bin/mysqld: Error while setting value  ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION  to  sql_mode .
2019-11-05T07:57:31.359330Z 0 [ERROR] [MY-013236] [Server] The designated data directory /usr/local/var/mysql is unusable. You can remove all files that the server added to it.
2019-11-05T07:57:31.359413Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-05T07:57:31.359514Z 0 [Note] [MY-010120] [Server] Binlog end

Took me some time to figure it out. Found a clue here: https://discourse.brew.sh/t/clean-removal-of-mysql/2251

So, the key to my problem was removing /usr/local/etc/my.cnf file after uninstall. After that one last step, MySql finally started working.

允许我sql的捐赠

I had the same issue after I tried to restart mysql.

在我的发言中,我使用了以下两点。

alias mysql-stop= launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist 
alias mysql-start= launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist  

我在停止我方言之后,然后试图重新开始工作。 我研究了发射机载荷,并报告了“未发现装载”错误。

After a quick search I found this..

http://www.daveoncode.com/2006/0702/01/solve-mac-osx-startctl-nothing-found-to-load-error/

因此,我更新了<条码>。 页: 1

alias mysql-start= launchctl load -w -F ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist 

这解决了我可能对你有用的问题。

上述答复(或我在其他场合看到的数十份答复中的任何答复)都没有用我的手法,用的是最新版本的我的手法。 我最后通过布局安装了不同的神秘面像。

说明旧版本(例如)

brew install mysql56

为我工作。 希望有助于人们。 这是一个令人沮丧的问题,我感到,像我一样,我一直 st。

Mysql的“基本健康”储存在/etc/my.cnf。 当你改写升级时,没有更新。 公正开放,改变基于价值

例如,修改:

[mysqld]
basedir=/Users/3st/homebrew/Cellar/mysql/5.6.13

指出新版本:

[mysqld]
basedir=/Users/3st/homebrew/Cellar/mysql/5.6.19

1. 重新启动我的工作计划:

mysql.server start

deleting>,<>,>,<> >,<> > >, > ∗∗∗∗





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...