Home>

If i use mysql with the appropriate command, I get errors and want to initialize the settings. Is there such a method?

The DB initialization method is also available on the internet.

-Uninstall and delete related files

Environment

mac
Install mysql using homebrew

Error i am facing
$sudo mysql.server start
Password:
Starting MySQL
ERROR! The server quit without updating PID file (/usr/local/var/mysql/rooter.pid).</Code></pre>
<pre><code>mysql>create database dotinstall_todo_app;
ERROR 1006 (HY000): Can't create database 'dotinstall_todo_app' (errno: 2)
/usr/local/var folder (rooter.pid cannot be placed in/usr/local/var/mysql)

Delete command list
sudo rm -rf/usr/local/Cellar/mysql *
sudo rm -rf/usr/local/bin/mysql *
sudo rm -rf/usr/local/var/mysql *
sudo rm -rf /usr/local/etc/my.cnf
sudo rm -rf/usr/local/share/mysql *
sudo rm -rf/usr/local/opt/mysql *
sudo rm -rf /etc/my.cnf
rm -rf ~/Library/PreferencePanes/My *
sudo rm/usr/local/mysql
sudo rm -rf/usr/local/mysql *
sudo rm -rf/Library/StartupItems/MySQLCOM
sudo 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 /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Permission list
rooter: local siro $pwd
/ usr/local
rooter: local siro $ls -l
total 0
drwxrwxr-x 8 siro admin 256 11 30 17:49 share
drwxrwxr-x 5 siro admin 160 12 1 17:04 var ←←← here
(Omitted)
rooter: var siro $pwd
/ usr/local/var
rooter: var siro $ls -l
total 0
drwxrwxr-x 4 siro admin 128 11 30 17:43 homebrew
drwxr-xr-x 11 siro admin 352 12 2 08:27 mysql ←←← here
(Omitted)
rooter: mysql siro $pwd
/ usr/local/var/mysql
rooter: mysql siro $ls -l
total 247944
-rw-rw ---- 1 siro admin 56 12 1 13:28 auto.cnf
-rw-rw ---- 1 siro admin 50331648 12 2 08:28 ib_logfile0
-rw-rw ---- 1 siro admin 50331648 12 1 13:28 ib_logfile1
-rw-rw ---- 1 siro admin 12582912 12 2 08:28 ibdata1
drwx ------ 81 siro admin 2592 12 1 13:28 mysql
drwx ------ 55 siro admin 1760 12 1 13:28 performance_schema
-rw-r ----- 1 siro admin 13162625 12 2 08:28 rooter.err
drwx ------ 2 siro admin 64 12 1 13:28 test
Tail -n100 /usr/local/var/mysql/rooter.err Error when executing + last line
(omitted)
2019-12-04 07:02:12 52724 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2019-12-04 07:02:12 52724 [ERROR] Do you already have another mysqld server running on port: 3306?
2019-12-04 07:02:12 52724 [ERROR] Aborting
(Omitted)
The last was finished with the line below.
191204 07:02:14 mysqld_safe mysqld from pid file /usr/local/var/mysql/rooter.pid ended
  • Answer # 1

    "I want to save my data, but the settings are initial"
    If so, export the data, re-install it (you should change the port just in case), and import the data there.

  • Answer # 2

    Is Permission understood?
    Please check the permissions of each directory from Terminal instead of Finder.
    In the example below, nandymak is the user ID and admin is the group.

    drwxrwxr-x 5 nandymak admin 160 5 28 2019 var


    The "d" in "drwxrwxr-x" indicates the directory, and the subsequent three digits indicate the self, group, and other permissions.
    If you don't have write access to/usr/local/var or/usr/local/var/mysql, it won't work.

    nandymak @ nandymak Julia-Tutorial% cd/usr/local
    nandymak @ nandymak local% ll
    total 0
    drwxrwxr-x 5 nandymak admin 160 5 28 2019 var ←←← here
    drwxr-xr-x 19 root wheel 608 6 12 02:29 go
    (Omitted)
    nandymak @ nandymak local% ll var /
    total 0
    drwxrwxr-x 4 nandymak admin 128 4 13 2019 homebrew
    drwxr-xr-x 3 nandymak admin 96 5 17 2019 cache
    drwxr-xr-x 19 nandymak admin 608 11 26 20:51 mysql ←←← here
    nandymak @ nandymak local% ll var/mysql
    total 251984
    (Omitted)
    -rw-rw ---- 1 nandymak admin 5 11 3 04:37 nandymak.local.pid ←←← here
    -rw-rw ---- 1 nandymak admin 50331648 11 3 04:37 ib_logfile0
    -rw-rw ---- 1 nandymak admin 12582912 11 3 04:37 ibtmp1
    drwx ------ 3 nandymak admin 96 11 26 20:51 aws
    -rw-rw ---- 1 nandymak admin 2793146 11 26 22:31 nandymak.local.err
    nandymak @ nandymak local%

    Isn't one set up properly, or isn't the user ID rooter strange?

    * Please check various things so that you can use Terminal.

  • Answer # 3

    . ERROR! The server quit without updating PID file (/usr/local/var/mysql/rooter.pid).

    In my environment it looks like this:

    nandymak @ nandymak Julia-Tutorial% ll/usr/local/var/mysql /
    total 251984
    drwx ------ 92 nandymak admin 2944 5 28 2019 mysql
    (Omitted)
    -rw-rw ---- 1 nandymak admin 5 11 3 04:37 nandymak.local.pid
    (Omitted)
    -rw-rw ---- 1 nandymak admin 2793146 11 26 22:31 nandymak.local.err
    nandymak @ nandymak Julia-Tutorial%
      

    /usr/local/var/mysql/rooter.pid
      Isn't it broken or doesn't exist?

    Please do the following with reference to the following article. I am a little worried that the file name is not ****. Local.pid. . .

    touch /usr/local/var/mysql/rooter.pid

    Qiita: MySQL cannot be started. The server quit without updating PID file

Trends