No, I do not find any my.cnf in my datadir.

There were two problems here, the first of which I’ve fixed.

(1) FIXED: Trouble caused by mysql client binary being no found or pointing to 
mysql57 rather than mysql8.

        - For my default interactive shell zsh, getting rid of loading  
oh-my-zsh.sh in .zshrc.
        
        - For both zsh and bash, fixing .profile so that I have 
/opt/local/lib/mysql8/bin near the start of my path (instead of 
/opt/local/lib/mysql57/bin).
        using zsh as the default interactive shell.

        After those fixes, and after, of course...

                                sudo port select mysql mysql8
        Selecting 'mysql8' for 'mysql' succeeded. 'mysql8' is now active.

        …now the correct client is being found:

                        sudo port load mysql8-server
        --->  Loading startupitem 'mysql8-server' for mysql8-server

                which mysql
        /opt/local/lib/mysql8/bin/mysql

(2) NOT FIXED: Whether now in zhs or bash, there’s something wrong with the 
socket

                        sudo port load mysql8-server
        Loading startupitem 'mysql8-server' for mysql8-server

             mysql        # [or use: /opt/local/bin/mysql]
        ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
'/opt/local/var/run/mysql8/mysqld.sock' (2)

        And that is despite having /opt/local/etc/mysql8/my.cnf being:

        # Use default MacPorts settings 
        !include /opt/local/etc/mysql8/macports-default.cnf 

        [mysqld] 
        datadir = /Users/murray/Databases/mysql/data 
        socket = /opt/local/var/run/mysql8/mysqld.sock 
        pid-file = /opt/local/var/run/mysqld/mysqld.pid 

        sql_mode=NO_ENGINE_SUBSTITUTION,STRICTΩTRANS_TABLES 

        [client] 
        socket = /opt/local/var/run/mysql8/mysqld.sock


> On 2 Oct2020, at 9:05 PM, Ryan Schmidt <[email protected]> wrote:
> 
> 
> 
> On Oct 2, 2020, at 19:36, Murray Eisenberg wrote:
> 
>> Assuming I do _not_ want to initialize the database, given that I want to 
>> use an existing (MySQL 5.7) database with the newly installed MySQL8, I 
>> loaded mysql8-server, then tried to connect to it:
>> 
>>              mysql
>>      ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
>> '/opt/local/var/run/mysql57/mysqld.sock' (2)
>> 
>> Note:
>> 
>>              sudo port select --show mysql
>>      The currently selected version for 'mysql' is 'mysql8’.
>> 
>> So the error from trying to execute ‘mysql’ is surprising! Here’s my 
>> configuration file /opt/local/etc/mysql8/my.cnf :
>> 
>>      # Use default MacPorts settings
>>      !include /opt/local/etc/mysql8/macports-default.cnf
>> 
>>      [mysqld]
>>              datadir = /Users/murray/Databases/mysql/data
>>      port = 3306
>>      socket = /opt/local/var/run/mysql8/mysqld.sock
>>      pid-file = /opt/local/var/run/mysqld/mysqld.pid
>> 
>>      sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
>> 
>>      [client]
>>      socket = /opt/local/var/run/mysql8/mysqld.sock
>> 
>> What’s wrong??
> 
> I'm not sure. Your questions are probably not specific to MacPorts; they're 
> more MySQL-specific, so you might have more luck asking in a MySQL support 
> venue.
> 
> What does "which mysql" say? What about "mysql --version"?
> 
> Could there be a my.cnf file in /Users/murray/Databases/mysql/data that's 
> overriding your settings?

---
Murray Eisenberg                        [email protected]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667        Mobile (413)-427-5334


Reply via email to