I just updated a MySQL database from 5.5 to 5.6. I'm attempting to follow best practices so I used mysql_config_editor to create a .mylogin.cnf file:
mysql_config_editor set --login-path=local --host=localhost --user=example --password
However, when I try mysql --login-path=local I get this error:
ERROR 1045 (28000): Access denied for user 'example'#'localhost' (using password: YES)
However, I can still login using mysql -u example -p, and then pasting the password at the prompt. I've triple-checked that I'm using the correct password in my mysql_config_editor command.
My grants look like this:
mysql> show grants;
+------------------------------------------------------------------------------+
| Grants for example#localhost |
+------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'example'#'localhost' IDENTIFIED BY PASSWORD <secret> |
| GRANT ALL PRIVILEGES ON `example`.* TO 'example'#'localhost' |
+------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
This is the output to /var/log/mysql/error.log when I restart MySQL:
160223 12:31:41 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160223 12:31:42 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-02-23 12:31:43 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-02-23 12:31:43 0 [Note] /usr/sbin/mysqld (mysqld 5.6.29) starting as process 31337 ...
2016-02-23 12:31:43 31337 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2016-02-23 12:31:43 31337 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)
2016-02-23 12:31:43 31337 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
2016-02-23 12:31:43 31337 [Note] Plugin 'FEDERATED' is disabled.
2016-02-23 12:31:43 31337 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-02-23 12:31:43 31337 [Note] InnoDB: The InnoDB memory heap is disabled
2016-02-23 12:31:43 31337 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-02-23 12:31:43 31337 [Note] InnoDB: Memory barrier is not used
2016-02-23 12:31:43 31337 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-02-23 12:31:43 31337 [Note] InnoDB: Using Linux native AIO
2016-02-23 12:31:43 31337 [Note] InnoDB: Using CPU crc32 instructions
2016-02-23 12:31:43 31337 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-02-23 12:31:43 31337 [Note] InnoDB: Completed initialization of buffer pool
2016-02-23 12:31:43 31337 [Note] InnoDB: Highest supported file format is Barracuda.
2016-02-23 12:31:43 31337 [Note] InnoDB: 128 rollback segment(s) are active.
2016-02-23 12:31:43 31337 [Note] InnoDB: Waiting for purge to start
2016-02-23 12:31:43 31337 [Note] InnoDB: 5.6.29 started; log sequence number 1660606
SSL error: Unable to get certificate from '/etc/mysql/server-cert.pem'
2016-02-23 12:31:43 31337 [Warning] Failed to setup SSL
2016-02-23 12:31:43 31337 [Warning] SSL error: Unable to get certificate
2016-02-23 12:31:43 31337 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2016-02-23 12:31:43 31337 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2016-02-23 12:31:43 31337 [Note] Server socket created on IP: '127.0.0.1'.
2016-02-23 12:31:43 31337 [Note] Event Scheduler: Loaded 0 events
2016-02-23 12:31:43 31337 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.29' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
Do you see anything in the log that might indicate why I can't login using the --login-path option?
Add double quotes to your password. It worked for me.
You should be using the socket to log in locally. Try specifying the mysql_config_editor command with the --socket=/path/to/mysqld.sock option that's correct for your MySQL instance.
I had this problem, and thought I'd share my solution in my case:
TLDR: Manually Connecting Works because the Default Host is Not Local, But You're Configuring MySQL_Config_Editor with Local
Your example of logging in omits the -h parameter: mysql -u example -p. To see what host mysql is connecting to, look at the results of: mysql --print-defaults. You get something like...
--user=ExampleUser
--password=*****
--host=host.example.com
--port=12345
The --host value you see here should exactly match what you are putting into the host value here, in order to make it work correctly:
mysql_config_editor set --host=host.example.com --user=example --password
In addition, I recommend trying without the --login-path=local, since it may actually well be that your host, according to the defaults, is not local or localhost.
According to the docs, the login-path parameter contains "options that specify which MySQL server to connect to and which account to authenticate as." (Source: Dev.MySQL.com.) So, I think your problem may be like mine: a mismatch of the right host value while also dropping --login-path=local.
Related
I installed php:8.0.9-apache under docker and checking logs after installation I see some
warnings in mysql part :
2021-10-15 14:48:59+03:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.35-1debian10 started.
2021-10-15 14:49:00+03:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-10-15 14:49:00+03:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.35-1debian10 started.
2021-10-15T11:49:00.429892Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-10-15T11:49:00.432747Z 0 [Note] mysqld (mysqld 5.7.35) starting as process 1 ...
2021-10-15T11:49:00.437047Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-10-15T11:49:00.437068Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-10-15T11:49:00.437072Z 0 [Note] InnoDB: Uses event mutexes
2021-10-15T11:49:00.437077Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-10-15T11:49:00.437081Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-10-15T11:49:00.437085Z 0 [Note] InnoDB: Using Linux native AIO
2021-10-15T11:49:00.437330Z 0 [Note] InnoDB: Number of pools: 1
2021-10-15T11:49:00.437445Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-10-15T11:49:00.439834Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-10-15T11:49:00.451513Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-10-15T11:49:00.454482Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-10-15T11:49:00.473993Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-10-15T11:49:00.511954Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-10-15T11:49:00.513212Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-10-15T11:49:00.679673Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-10-15T11:49:00.681160Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-10-15T11:49:00.681185Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-10-15T11:49:00.681582Z 0 [Note] InnoDB: Waiting for purge to start
2021-10-15T11:49:00.732209Z 0 [Note] InnoDB: 5.7.35 started; log sequence number 12659641
2021-10-15T11:49:00.734197Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-10-15T11:49:00.737074Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-10-15T11:49:00.744353Z 0 [Warning] World-writable config file './auto.cnf' is ignored.
2021-10-15T11:49:00.746941Z 0 [Warning] World-writable config file './auto.cnf' has been removed.
2021-10-15T11:49:00.747343Z 0 [Note] Salting uuid generator variables, current_pid: 1, server_start_time: 1634298540, bytes_sent: 0,
2021-10-15T11:49:00.747433Z 0 [Note] Generated uuid: 'e3496a7a-2dad-11ec-9925-0242ac160002', server_start_time: 281476611009197, bytes_sent: 94189482984608
2021-10-15T11:49:00.747464Z 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: e3496a7a-2dad-11ec-9925-0242ac160002.
2021-10-15T11:49:00.777304Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-10-15T11:49:00.777328Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-10-15T11:49:00.777334Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2021-10-15T11:49:00.777336Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2021-10-15T11:49:00.781639Z 0 [Warning] CA certificate ca.pem is self signed.
2021-10-15T11:49:00.781737Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-10-15T11:49:00.782643Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-10-15T11:49:00.782677Z 0 [Note] IPv6 is available.
2021-10-15T11:49:00.782690Z 0 [Note] - '::' resolves to '::';
2021-10-15T11:49:00.782702Z 0 [Note] Server socket created on IP: '::'.
2021-10-15T11:49:00.793751Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-10-15T11:49:00.800000Z 0 [Note] InnoDB: Buffer pool(s) load completed at 211015 14:49:00
2021-10-15T11:49:00.853789Z 0 [Note] Event Scheduler: Loaded 0 events
2021-10-15T11:49:00.854072Z 0 [Note] mysqld: ready for connections.
Version: '5.7.35' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
In docker-compose.yml I have :
mysql_db:
container_name: Hostels4J_db
image: mysql:5.7.35
restart: always
environment:
- MYSQL_DATABASE=dbname
- MYSQL_USER=user
- MYSQL_PASSWORD=321
- MYSQL_ALLOW_EMPTY_PASSWORD=false
- MYSQL_ROOT_PASSWORD=321
Testing how app works these warnings seems not critical, but I am not sure have I try to fix them
or I can I get rid of them? I would like to see my logs as clear as possible...
MODIFIED # 1 :
But where have I to change the file permissions ?
In the docker-compose.ymlfile I have :
mysql_db:
container_name: Hostels4J_db
image: mysql:5.7.35
# image: mysql:8.0.21
restart: always
environment:
- MYSQL_DATABASE=DockerHostels4J
- MYSQL_USER=docker_user
- MYSQL_PASSWORD=4321
- MYSQL_ALLOW_EMPTY_PASSWORD=false
- MYSQL_ROOT_PASSWORD=321
volumes:
- ${DB_PATH_HOST}:/var/lib/mysql
and in Dockerfile.yml :
RUN docker-php-ext-install pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite
These are all mysql options I have...
Thanks in advance!
Inside the mysql container image there seems to be a file auto.cnf that is world writable. Maybe the file permissions are set to 777? Reduce these permissions before running the container.
This is usually done at build-time using docker build ... and some Dockerfile.
MODIFIED 1:
In your dockerfile you will like to have something like
RUN chmod <less access privileges> <full path to auto.cnf>
To verify when running docker build, you could use
RUN ls -l <full path to auto.cnf>
Since your log output above only gives a relative path I cannot tell where exactly to find that file. But you could again use
RUN find / -name auto.cnf
There is one exception actually: if you happen to find the file inside the container in /var/lib/mysql, then actually it got mapped in there as external filesystem. In that case find the file in the hosts filesystem location, reduce the permissions and do not worry about the Dockerfile any more.
I am working with MySQL docker image version 5.7 with initialize the data by the schema file but got some error can't solve.
My docker command line is:
docker run --name mysql -e MYSQL_ROOT_PASSWORD='abc123' -v /Users/jenkins/Desktop/irms:/docker-entrypoint-initdb.d mysql:5.7
and get the error, the log as below:
$ docker run --name mysql -e MYSQL_ROOT_PASSWORD='abc123' -v /Users/jenkins/Desktop/irms:/docker-entrypoint-initdb.d mysql:5.7
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Initializing database files
2021-03-17T02:05:15.606058Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-03-17T02:05:15.756090Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-03-17T02:05:15.779384Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-03-17T02:05:15.837663Z 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: 373d4ffb-86c5-11eb-8780-0242ac110002.
2021-03-17T02:05:15.839186Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-03-17T02:05:16.450734Z 0 [Warning] CA certificate ca.pem is self signed.
2021-03-17T02:05:16.576740Z 1 [Warning] root#localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2021-03-17 02:05:18+00:00 [Note] [Entrypoint]: Database files initialized
2021-03-17 02:05:18+00:00 [Note] [Entrypoint]: Starting temporary server
2021-03-17 02:05:18+00:00 [Note] [Entrypoint]: Waiting for server startup
2021-03-17T02:05:18.819727Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-03-17T02:05:18.820623Z 0 [Note] mysqld (mysqld 5.7.33) starting as process 78 ...
2021-03-17T02:05:18.822725Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-03-17T02:05:18.822772Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-03-17T02:05:18.822783Z 0 [Note] InnoDB: Uses event mutexes
2021-03-17T02:05:18.822789Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-03-17T02:05:18.822795Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-03-17T02:05:18.822800Z 0 [Note] InnoDB: Using Linux native AIO
2021-03-17T02:05:18.823072Z 0 [Note] InnoDB: Number of pools: 1
2021-03-17T02:05:18.823301Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-03-17T02:05:18.824551Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-03-17T02:05:18.829149Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-03-17T02:05:18.830692Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-03-17T02:05:18.841912Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-03-17T02:05:18.846985Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-03-17T02:05:18.847098Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-03-17T02:05:18.862891Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-03-17T02:05:18.863475Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-03-17T02:05:18.863521Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-03-17T02:05:18.863960Z 0 [Note] InnoDB: Waiting for purge to start
2021-03-17T02:05:18.914486Z 0 [Note] InnoDB: 5.7.33 started; log sequence number 2746831
2021-03-17T02:05:18.915203Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-03-17T02:05:18.915523Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-03-17T02:05:18.916967Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210317 2:05:18
2021-03-17T02:05:18.920098Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-03-17T02:05:18.920168Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-03-17T02:05:18.920570Z 0 [Warning] CA certificate ca.pem is self signed.
2021-03-17T02:05:18.920635Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-03-17T02:05:18.922497Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-03-17T02:05:18.926990Z 0 [Note] Event Scheduler: Loaded 0 events
2021-03-17T02:05:18.927219Z 0 [Note] mysqld: ready for connections.
Version: '5.7.33' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL)
2021-03-17 02:05:19+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2021-03-17 02:05:20+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/IRMSDB_2021-03-09.sql
ERROR 1064 (42000) at line 287: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inet addr:'| cut -d: -f2 | awk '{ print $1}'", "commandName": "IP"}], "clamAvInt' at line 5
I checked my schema file and no idea what the error exactly and no idea how to fix it.
My schema file is exported from Sequel Pro.
Could you kindly provide some idea to solve the problem?
Thanks very much.
Just attached my schema file below, and please change the extension name from jpg to SQL.
Click here to download: MySQL schema file
I'm trying to run the MySQL Server after importing a big database file 32 GB length mismatch in the column name
MySQL 5.7 using rh-mysql57
After using the command to run the server I'm getting a success message saying
/etc/init.d/rh-mysql57-mysqld restart
Stopping rh-mysql57-mysqld: [ OK ]
Starting rh-mysql57-mysqld: [ OK ]
The i want to loggin to the mysql using mysql with/without password
i'm getting this error
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
This is the error.log
2019-06-19T13:24:05.489656Z mysqld_safe Starting mysqld daemon with databases from /var/opt/rh/rh-mysql57/lib/mysql
2019-06-19T13:24:05.751511Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld (mysqld 5.7.24-log) starting as process 19830 ...
2019-06-19T13:24:05.816168Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-06-19T13:24:05.816207Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-19T13:24:05.816225Z 0 [Note] InnoDB: Uses event mutexes
2019-06-19T13:24:05.816240Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2019-06-19T13:24:05.816254Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2019-06-19T13:24:05.816268Z 0 [Note] InnoDB: Using Linux native AIO
2019-06-19T13:24:05.818025Z 0 [Note] InnoDB: Number of pools: 1
2019-06-19T13:24:05.818276Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2019-06-19T13:24:05.821067Z 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2019-06-19T13:24:06.062258Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-06-19T13:24:06.095072Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-06-19T13:24:06.107846Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-06-19T13:24:06.275233Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-06-19T13:24:06.275514Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-06-19T13:24:06.360584Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-06-19T13:24:06.362431Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-06-19T13:24:06.362460Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-06-19T13:24:06.364052Z 0 [Note] InnoDB: 5.7.24 started; log sequence number 322424549252
2019-06-19T13:24:06.364899Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/opt/rh/rh-mysql57/lib/mysql/ib_buffer_pool
2019-06-19T13:24:06.365282Z 0 [Note] Plugin 'FEDERATED' is disabled.
2019-06-19T13:24:06.366882Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190619 15:24:06
2019-06-19T13:24:06.381320Z 0 [Warning] InnoDB: Table mysql/innodb_table_stats has length mismatch in the column name table_name. Please run mysql_upgrade
2019-06-19T13:24:06.381431Z 0 [Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch in the column name table_name. Please run mysql_upgrade
2019-06-19T13:24:06.387318Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2019-06-19T13:24:06.387370Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2019-06-19T13:24:06.398153Z 0 [Warning] CA certificate ca.pem is self signed.
2019-06-19T13:24:06.398250Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2019-06-19T13:24:06.399654Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2019-06-19T13:24:06.424466Z 0 [Note] IPv6 is not available.
2019-06-19T13:24:06.424509Z 0 [Note] - '0.0.0.0' resolves to '0.0.0.0';
2019-06-19T13:24:06.424554Z 0 [Note] Server socket created on IP: '0.0.0.0'.
2019-06-19T13:24:06.436535Z 0 [Note] Failed to start slave threads for channel ''
2019-06-19T13:24:06.449394Z 0 [Note] Event Scheduler: Loaded 0 events
2019-06-19T13:24:06.449666Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld: ready for connections.
Version: '5.7.24-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
2019-06-19T13:24:07.101293Z 2 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'#'localhost' (using password: NO)
2019-06-19T13:24:36.051422Z 3 [Note] Access denied for user 'root'#'localhost' (using password: YES)
The problem as I understand is coming from here
2019-06-19T13:24:06.381320Z 0 [Warning] InnoDB: Table mysql/innodb_table_stats has length mismatch in the column name table_name. Please run mysql_upgrade
2019-06-19T13:24:06.381431Z 0 [Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch in the column name table_name. Please run mysql_upgrade
I've tried to run mysql_upgrade and the result is
mysql_upgrade: Got error: 1045: Access denied for user 'root'#'localhost' (using password: YES) while connecting to the MySQL server
Upgrade process encountered an error and will not continue
The problem was due to an import conflict between MySQL tables from the production server and test server.
As the file was large so difficult to modify the contents of the SQL file.
So the mysql database was imported too.
CAUTION BEFORE PROCESSING PLEASE BACKUP YOUR DATABASE!
The solution that worked for us is like the rest
1- Stop the mysql server
ref: https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html
2-Added the following parameters to
/etc/my.cnf
ref: https://dev.mysql.com/doc/refman/5.7/en/system-schema.html
innodb_force_recovery = 1
skip-grant-tables
3- In the database directory, save the folder mysql copy themysql folder and empty the contents
4- Then execute the command
bin\mysqld --initialize
ref:
https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html
5- At the end execute the command
bin\mysql_upgrade
ref: https://dev.mysql.com/doc/refman/5.7/en/mysql-upgrade.html
6- Start the mysql server again
ref: https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html
I got the same issue & error while working with docker.
docker exec -it container_name bash -c "mysql_upgrade -uroot -proot"
source: Running mysql_upgrade in Docker?
This started off as a root password resetting exercise- but been running into various errors: Currently stuck at conflicts on 3306 port. See last few paras of the question if you want to skip the previous steps (I just kept updating the question & title as I made progress). Thank you.
I have a mac with mysql installed- but I cant remember the password hence I've been trying to reset it using: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html (section:B.5.3.2.2 Resetting the Root Password: Unix and Unix-Like Systems).
While running this command:
mysqld --init-file=/home/me/mysql-init &
I got this error:
`[1] 70374
Deepaks-MacBook-Air:data root# 2018-05-06T08:35:29.269289Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T08:35:29.271535Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T08:35:29.272815Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 70374 ...
2018-05-06T08:35:29.290319Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-05-06T08:35:29.290429Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2018-05-06T08:35:29.290472Z 0 [ERROR] Aborting
2018-05-06T08:35:29.290494Z 0 [Note] Binlog end
2018-05-06T08:35:29.293896Z 0 [Note] mysqld: Shutdown complete
[1]+ Done(1)`
Hence I'm trying this command:
sudo /usr/local/mysql/support-files/mysql.server start --init-file=/usr/local/mysql/data/mysql-init
but now I'm getting this error:
ERROR! The server quit without updating PID file (/usr/local/mysql/data/Deepaks-MacBook-Air.local.pid).
The following is the content of the log file:
2018-05-06T08:03:52.799002Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T08:03:52.801385Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T08:03:52.801495Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.21) starting as process 69954 ...
2018-05-06T08:03:52.810622Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2018-05-06T08:03:52.832273Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-06T08:03:52.832306Z 0 [Note] InnoDB: Uses event mutexes
2018-05-06T08:03:52.832313Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-06T08:03:52.832319Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-06T08:03:52.832780Z 0 [Note] InnoDB: Number of pools: 1
2018-05-06T08:03:52.833783Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-06T08:03:52.838027Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-06T08:03:52.856588Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-06T08:03:52.876537Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-06T08:03:52.899436Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-06T08:03:52.900043Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-06T08:03:52.944160Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-06T08:03:52.946174Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-06T08:03:52.946218Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-06T08:03:52.946641Z 0 [Note] InnoDB: Waiting for purge to start
2018-05-06T08:03:53.001405Z 0 [Note] InnoDB: 5.7.21 started; log sequence number 2551377
2018-05-06T08:03:53.001712Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql-5.7.21-macos10.13-x86_64/data/ib_buffer_pool
2018-05-06T08:03:53.001962Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-05-06T08:03:53.019470Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-05-06T08:03:53.020660Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180506 13:33:53
2018-05-06T08:03:53.026724Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-05-06T08:03:53.026844Z 0 [Note] IPv6 is available.
2018-05-06T08:03:53.026872Z 0 [Note] - '::' resolves to '::';
2018-05-06T08:03:53.026926Z 0 [Note] Server socket created on IP: '::'.
2018-05-06T08:03:53.087999Z 0 [Note] Event Scheduler: Loaded 0 events
2018-05-06T08:03:53.088163Z 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.7.21' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
2018-05-06T08:12:46.664218Z 2 [Note] Access denied for user 'root'#'localhost' (using password: NO)
2018-05-06T09:35:55.013341Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 2948657ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
Whats wrong and how to fix this?
PS: I've been referring to these two SO, and am trying nearly all solutions in all answers- reseting permissions to removing all files in /usr/local/var/mysql. It still the same issue, I suspect its something to do with mysqld not running properly- is there a special way to run it as root. I'm currently trying to run in root mode in terminal by sudo -i. Can someone help me debug this? Thanks
mysql version:
> mysql --version
mysql Ver 14.14 Distrib 5.7.21, for osx10.12 (x86_64) using EditLine wrapper
UPDATE: I read the security documentation- apparently you aren't supposed to run it as root mode. So I logged out using exit.
Now, I'm getting the following situation:
Deepaks-MacBook-Air:mysql deepak$ mysqld --init-file=/usr/local/mysql/data/mysql-init &
[2] 72004
Deepaks-MacBook-Air:mysql deepak$ mysqld: Can't change dir to '/usr/local/var/mysql/' (Errcode: 2 - No such file or directory)
2018-05-06T10:59:48.877152Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T10:59:48.880902Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T10:59:48.881775Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 72004 ...
2018-05-06T10:59:48.897332Z 0 [Warning] Can't create test file /usr/local/var/mysql/Deepaks-MacBook-Air.lower-test
2018-05-06T10:59:48.897395Z 0 [Warning] Can't create test file /usr/local/var/mysql/Deepaks-MacBook-Air.lower-test
2018-05-06T10:59:48.897593Z 0 [ERROR] failed to set datadir to /usr/local/var/mysql/
2018-05-06T10:59:48.897607Z 0 [ERROR] Aborting
2018-05-06T10:59:48.897624Z 0 [Note] Binlog end
2018-05-06T10:59:48.899188Z 0 [Note] mysqld: Shutdown complete
which I suspect is due to the removal of my /usr/local/var/mysql directory as was suggested in one of the other answers. I'd deleted that using rm -rf. I made an new dir mkdir mysql in var and ran mysqld --init-file=/usr/local/mysql/data/mysql-init &, and it initially gives me a pid but then the logs ask me if 3306 port is already occupied:
2018-05-06T11:04:14.215705Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2018-05-06T11:04:14.218651Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-05-06T11:04:14.225038Z 0 [Note] Salting uuid generator variables, current_pid: 72031, server_start_time: 1525604653, bytes_sent: 0,
2018-05-06T11:04:14.225601Z 0 [Note] Generated uuid: '36553708-511d-11e8-ba65-c83fe4b8ed7b', server_start_time: 1828179975261387404, bytes_sent: 140216128435712
2018-05-06T11:04:14.225667Z 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: 36553708-511d-11e8-ba65-c83fe4b8ed7b.
2018-05-06T11:04:14.241961Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T11:04:14.391057Z 0 [Note] Auto generated SSL certificates are placed in data directory.
2018-05-06T11:04:14.391874Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T11:04:14.490103Z 0 [Note] Auto generated RSA key files are placed in data directory.
2018-05-06T11:04:14.499147Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2018-05-06T11:04:14.499239Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-05-06T11:04:14.499424Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-05-06T11:04:14.499495Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2018-05-06T11:04:14.499503Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2018-05-06T11:04:14.499536Z 0 [ERROR] Aborting
I actually have two folders in my /usr/local/ - mysql and mysql-5.7.21-macos10.13-x86_64. The whole process so far, I've been running in the 'mysqlfolder and haven't really touchedmysql-5.7.21-macos10.13-x86_64`. They seem to have the same directory structure inside.
Also when I do ps aux | grep mysql, I get three processes:
Deepaks-MacBook-Air:local deepak$ ps aux | grep mysql
deepak 72071 100.0 0.0 2443044 1992 s002 S+ 4:44PM 0:00.01 grep mysql
_mysql 71985 0.0 0.2 2852472 13132 ?? Ss 4:25PM 0:00.66 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --keyring-file-data=/usr/local/mysql/keyring/keyring --early-plugin-load=keyring_file=keyring_file.so
root 71967 0.0 0.1 2460804 7992 s002 T 4:23PM 0:00.03 sudo mysqld --init-file=/usr/local/mysql/data/mysql-init
However, when I proceed to kill the second or the third one, they simply reappear when I do ps aux again.
Also, I usually use a portforwarding to connect to a remote MySQL host. So, every once a while and in local scripts I run "ssh -fNT -L 3307:localhost:3306 -i ~/key/deepak_ubuntu_16feb.pem ubuntu#ec2-AWS-HOS-TNA-ME.compute-1.amazonaws.com"
Could this be a conflict?
UPDATE:
OK, I ignored the other directory and simply changed the port, that seemed to now avoid the conflict, but now has a different problem: mysql.sock.lock cant be accessed?
Deepaks-MacBook-Air:mysql deepak$ mysqld --init-file=/usr/local/mysql/data/mysql-init --port=3308 &
[2] 72160
Deepaks-MacBook-Air:mysql deepak$ 2018-05-06T11:32:45.441642Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T11:32:45.443453Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T11:32:45.444202Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 72160 ...
2018-05-06T11:32:45.463651Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-05-06T11:32:45.478310Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-06T11:32:45.478366Z 0 [Note] InnoDB: Uses event mutexes
2018-05-06T11:32:45.478375Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-06T11:32:45.478384Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-06T11:32:45.480830Z 0 [Note] InnoDB: Number of pools: 1
2018-05-06T11:32:45.483263Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-06T11:32:45.487576Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-06T11:32:45.507092Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-06T11:32:45.538289Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-06T11:32:45.565701Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-06T11:32:45.565987Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-06T11:32:45.622322Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-06T11:32:45.623627Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-06T11:32:45.623652Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-06T11:32:45.623974Z 0 [Note] InnoDB: Waiting for purge to start
2018-05-06T11:32:45.678385Z 0 [Note] InnoDB: 5.7.21 started; log sequence number 1209980
2018-05-06T11:32:45.678936Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/var/mysql/ib_buffer_pool
2018-05-06T11:32:45.680200Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-05-06T11:32:45.680346Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180506 17:02:45
mysqld: Table 'mysql.plugin' doesn't exist
2018-05-06T11:32:45.680885Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-05-06T11:32:45.684081Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T11:32:45.686185Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-05-06T11:32:45.686212Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2018-05-06T11:32:45.691365Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T11:32:45.691562Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2018-05-06T11:32:45.693912Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3308
2018-05-06T11:32:45.694589Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-05-06T11:32:45.694853Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-05-06T11:32:45.695047Z 0 [ERROR] Could not open unix socket lock file /tmp/mysql.sock.lock.
2018-05-06T11:32:45.695067Z 0 [ERROR] Unable to setup unix socket lock file.
2018-05-06T11:32:45.695092Z 0 [ERROR] Aborting
OK, so I went into /tmp/ and tried to check permissions of the file- below are the results:
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock.lock
16777220 3413029 -rw------- 1 _mysql wheel 0 6 "May 6 16:25:35 2018" "May 6 16:25:35 2018" "May 6 16:25:35 2018" "May 6 16:25:35 2018" 4096 8 0 mysql.sock.lock
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock
16777220 3413030 srwxrwxrwx 1 _mysql wheel 0 0 "May 6 16:25:44 2018" "May 6 16:25:44 2018" "May 6 16:25:44 2018" "May 6 16:25:35 2018" 4096 0 0 mysql.sock
I'm trying the solutions from this SO post https://stackoverflow.com/questions/34954455/mysql-daemon-lock-issue, the change owner answer did not work. I'm a little hesitant to remove locking.
OK, this post: https://support.rackspace.com/how-to/checking-linux-file-permissions-with-ls/ quite neatly explains how to read those permissions- apparently in my case _mysql user and wheel are the owner and group respectively. That doesn't make sense because I've never come across wheel in anything out side a .whl context and I haven't encountered the _mysql before today. I've tried to change to that user earlier using su - _mysql and I couldn't guess the password- not sure if mysql sets this up by default, in which case I'm confused right about now.
UPDATE:
OK, I solved that my Chowning it:
Deepaks-MacBook-Air:tmp deepak$ sudo chown deepak mysql.sock
Deepaks-MacBook-Air:tmp deepak$ sudo chown deepak mysql.sock.lock
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock.lock
16777220 3413029 -rw------- 1 deepak wheel 0 6 "May 6 16:25:35 2018" "May 6 16:25:35 2018" "May 6 17:26:54 2018" "May 6 16:25:35 2018" 4096 8 0 mysql.sock.lock
Deepaks-MacBook-Air:tmp deepak$ stat mysql.sock
16777220 3413030 srwxrwxrwx 1 deepak wheel 0 0 "May 6 16:25:44 2018" "May 6 16:25:44 2018" "May 6 17:26:22 2018" "May 6 16:25:35 2018" 4096 0 0 mysql.sock
However, that gives rise to another error:
Can't open and lock privilege tables: Table 'mysql.user' doesn't exist.
Deepaks-MacBook-Air:mysql deepak$ mysqld --init-file=/usr/local/mysql/data/mysql-init --port=3308 &
[2] 72244
Deepaks-MacBook-Air:mysql deepak$ 2018-05-06T11:57:33.454182Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T11:57:33.456455Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-05-06T11:57:33.457505Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 72244 ...
2018-05-06T11:57:33.470925Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-05-06T11:57:33.482170Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-06T11:57:33.482216Z 0 [Note] InnoDB: Uses event mutexes
2018-05-06T11:57:33.482224Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-05-06T11:57:33.482231Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-06T11:57:33.486263Z 0 [Note] InnoDB: Number of pools: 1
2018-05-06T11:57:33.489217Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-05-06T11:57:33.494624Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-05-06T11:57:33.513877Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-05-06T11:57:33.546517Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-06T11:57:33.575022Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-05-06T11:57:33.575404Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-05-06T11:57:33.620985Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-05-06T11:57:33.622662Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-05-06T11:57:33.622693Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-05-06T11:57:33.623068Z 0 [Note] InnoDB: Waiting for purge to start
2018-05-06T11:57:33.677963Z 0 [Note] InnoDB: 5.7.21 started; log sequence number 1209999
2018-05-06T11:57:33.679157Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/var/mysql/ib_buffer_pool
2018-05-06T11:57:33.680426Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180506 17:27:33
2018-05-06T11:57:33.681987Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2018-05-06T11:57:33.684004Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-05-06T11:57:33.688066Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T11:57:33.690386Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-05-06T11:57:33.690502Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2018-05-06T11:57:33.694745Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T11:57:33.694856Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2018-05-06T11:57:33.695461Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3308
2018-05-06T11:57:33.696028Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-05-06T11:57:33.696184Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-05-06T11:57:33.700436Z 0 [Warning] Failed to open optimizer cost constant tables
2018-05-06T11:57:33.704524Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2018-05-06T11:57:33.704983Z 0 [ERROR] Aborting
Alright, that got resolved by changing the owner from _mysql to my normal account using chown but now the the issue is:
Deepaks-MacBook-Air:mysql deepak$ mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --init-file=/usr/local/mysql/mysql-init --port=3308 &
[2] 72328
Deepaks-MacBook-Air:mysql deepak$ 2018-05-06T12:21:01.547203Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T12:21:01.550869Z 0 [ERROR] Can't find error-message file '/usr/local/mysql-5.7.21-macos10.13-x86_64/share/mysql/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2018-05-06T12:21:01.557694Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2018-05-06T12:21:01.557751Z 0 [ERROR] Aborting
Here is how I resolved this: the share folder didn't have a mysql directory and instead had the errmsg.sys in the english directory, I simply copied this file into a new directory I created in the share folder: mkdir mysql.
This worked but then showed:
Can't create directory '/usr/local/mysql/data/' (Errcode: 13 - Permission denied)
2018-05-06T12:49:13.313038Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T12:49:13.316262Z 0 [Warning] Using pre 5.5 semantics to load error messages from /usr/local/mysql-5.7.21-macos10.13-x86_64/share/mysql/.
2018-05-06T12:49:13.316285Z 0 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2018-05-06T12:49:13.322333Z 0 [ERROR] Aborting
Using chown, I changed the owner of mysql directory to my regular user account (strangely the mysql-5.7.21-macos10.13-x86_64 directory would not change its owner from group from root and wheel to anything even if I sudo'ed it.
So now the mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --init-file=/usr/local/mysql/mysql-init --port=3308 & command from /usr/local/mysql/ shows the following output:
Deepaks-MacBook-Air:local deepak$ mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --init-file=/usr/local/mysql/mysql-init --port=3308 &
[2] 72460
Deepaks-MacBook-Air:local deepak$ 2018-05-06T12:52:51.009693Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-06T12:52:51.013089Z 0 [Warning] Using pre 5.5 semantics to load error messages from /usr/local/mysql-5.7.21-macos10.13-x86_64/share/mysql/.
2018-05-06T12:52:51.013108Z 0 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2018-05-06T12:52:51.020232Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2018-05-06T12:52:51.549560Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-06T12:52:51.614133Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-06T12:52:51.692927Z 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: 630bcd34-512c-11e8-934a-45e8be00c2cf.
2018-05-06T12:52:51.711501Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-06T12:52:51.847929Z 0 [Warning] CA certificate ca.pem is self signed.
2018-05-06T12:52:51.903182Z 1 [Warning] root#localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
This seemed good but nothing is happening. Is this it? Can I start connecting using my SequelPro to 'localhost:3308' now? or is there some other caveats I need to resolve like setting temp password? Before even that, do I need to go into another terminal window to try mysql -u root and leave this running or what?
Also, when I don ps aux | grep mysql it shows three processes as before but does not show 72460 the one that mysqld just showed me now. Is this something I need to be concerned about?
This is the first time I'm doing this, and I'm scared to do anything right about now to not ruin the last few hours of efforts to fix this.
How do I resolve this? Thanks!
UPDATE: FINAL ISSUES:
OK, I'm dealing with a final set of issues, gonna ask in a seperate question.
1)
Deepaks-MacBook-Air:App deepak$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
and
2)
Deepaks-MacBook-Air:App deepak$ mysqladmin -u root
mysqladmin Ver 8.42 Distrib 5.7.21, for osx10.12 on x86_64
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Administration program for the mysqld daemon.
Usage: mysqladmin [OPTIONS] command command....
3) In my System Preferences > MySQL, it says "MySQL server instance is STOPPED".
Firstly, the issue with running as root is that mysqld doesn't want to have root privileges. You're not wrong to run it as root though, since the data directory should by default not be writable to your own user. Simply tell it to drop privileges and run as the "mysql" user, which is the default user mysqld runs under on macOS and likely the user who owns the data directory (note that "_mysqld" and "mysql" refer to the same user on macOS for historical reasons). You do this by adding -u mysql to mysqld's command line.
The two directories should really be only one directory (with the long name that includes a version number) and one symbolic link (/usr/local/mysql pointing to the directory). That's how the MySQL installer sets things up, the symlink always points to the latest version of MySQL that was installed.
The other mysqld you see running is the one started from launchd. This is also something the MySQL installer sets up. You can use the MySQL preference pane (which should be installed by default) to shut it down. Otherwise, macOS will keep restarting it because it interprets the shutdowns as random failures. The preference pane should be somewhere at the end of the bottom row in System Preferences.
The port forwarding thing should not be an issue. It will only be active while the ssh connection is up, and it doesn't even forward the same local port.
I am trying to install mySQL server on CentOS6.6 without root access.
Here are my steps.
Unpack mysql-8.0.11-linux-glibc2.12-i686 in a directory(EX:[Base MySQL Directory])
Initialize and generate root password:
./mysqld --initialize --user=mysql --lc_messages_dir=[Base MySQL Directory]/share --basedir=[Base MySQL Directory] --datadir=[BaseMySQL Directory]/data --log-error=[Base MySQL Directory]/data/mysql.err --pid-file=[Base MySQL Directory]/mysql.pid --socket=[Base MySQL Directory]/thesock --port=3306 &
Start the server:
./mysqld --user=mysql --basedir=[Base MySQL Directory] --lc_messages_dir=[Base MySQL Directory]/share --datadir=[Base MySQL Directory]/data --log-error=[Base MySQL Directory]/data/mysql.err --pid-file=[Base MySQL Directory]/mysql.pid --socket=[Base MySQL Directory]/thesock --port=3306 &
Access MySQL database:
./mysql --socket=$MYSQL_TED_HOME/thesock --user=root --password="IL-Rp=Wj*3dg"
But I got an Error message:
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1049 (42000): Unknown database 'test'
I know there are already tons of questions like "ERROR 1049 (42000): Unknown database....
". But I couldn't find any of them is similar to mine.
Here is "mysql.err":
[Warning] Changed limits: max_open_files: 1024 (requested 5000)
[Warning] Changed limits: table_open_cache: 431 (requested 2000)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] One can only use the --user switch if running as root
[Warning] InnoDB: New log files created, LSN=45790
[Warning] InnoDB: Creating foreign key constraint system tables.
[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: ec2d7935-43d0-11e8-96ee-d89d6726c984.
[Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
[Note] A temporary password is generated for root#localhost: IL-Rp=Wj*3dg
[Warning] Changed limits: max_open_files: 1024 (requested 5000)
[Warning] Changed limits: table_open_cache: 431 (requested 2000)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
[Note] ./mysqld (mysqld 5.7.13) starting as process 6390 ...
[Warning] One can only use the --user switch if running as root
[Note] InnoDB: PUNCH HOLE support not available
[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
[Note] InnoDB: Uses event mutexes
[Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
[Note] InnoDB: Compressed tables use zlib 1.2.3
[Note] InnoDB: Using Linux native AIO
[Note] InnoDB: Number of pools: 1
[Note] InnoDB: Using CPU crc32 instructions
[Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
[Note] InnoDB: Highest supported file format is Barracuda.
[Note] InnoDB: Creating shared tablespace for temporary tables
[Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
[Note] InnoDB: File './ibtmp1' size is now 12 MB.
[Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
[Note] InnoDB: 32 non-redo rollback segment(s) are active.
[Note] InnoDB: Waiting for purge to start
[Note] InnoDB: 5.7.13 started; log sequence number 2524437
[Note] InnoDB: Loading buffer pool(s) from [Base MySQL Directory]/mysql-5.7.13-linux-glibc2.5-x86_64/data/ib_buffer_pool
[Note] Plugin 'FEDERATED' is disabled.
[Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
[Note] Server hostname (bind-address): '*'; port: 3306
[Note] IPv6 is available.
[Note] - '::' resolves to '::';
[Note] Server socket created on IP: '::'.
[Note] InnoDB: Buffer pool(s) load completed at 180419 20:55:57
[Note] Event Scheduler: Loaded 0 events
[Note] ./mysqld: ready for connections.
Version: '5.7.13' socket: '[Base MySQL Directory]/thesock' port: 3306 MySQL Community Server (GPL)