I am trying to migrate a MySQL database to Aurora, but can't get the timezone set.
According to the documentation: "Valid values are the standard time zone abbreviations for the operating system hosting the source MySQL database."
Executing date on my Linux (Ubuntu) machine shows: Thu Dec 7 10:27:48 AEDT 2017.
I have configured the Source Endpoint to use:
Extra connection attributes: initstmt=SET time_zone=AEDT
Which results in my connection test to fail with:
Error Details: [errType=ERROR_RESPONSE, status=1022502, errMessage=Cannot connect to ODBC provider ODBC general error., errDetails= RetCode: SQL_ERROR SqlState: HY000 NativeError: 1298 Message: [unixODBC][MySQL][ODBC 5.3(w) Driver]Unknown or incorrect time zone: 'AEDT' ODBC general error.]
I've tried "Australia/Sydney" as well (same value as in RDS Parameter Groups) but getting the same error.
Any ideas?
I am totally aware of that this should be UTC. Not my choice - legacy.
Update: It seems initstmt=SET time_zone="+11:00" works, but leading to this issue.
Do you want to Migrate MySQL from a Linux server to Aurora, the user replication instead of DMS. DMS will not support many DDL during the data load. So create a replication between MySQL to Aurora.
Master - Your current MySQL.
slave - Aurora.
Prepare:
Both instances are able to communicate with each other.
The master must be 5.5 or greater version.
binlog_format to ROW on the Master MySQL.
Create user for replication:
CREATE USER 'rep_user'#'%' IDENTIFIED BY 'rep_user';
GRANT REPLICATION slave ON *.* TO 'rep_user'#'%' IDENTIFIED BY 'rep_user';
FLUSH PRIVILEGES;
Take dump with Binlog details:
mysqldump -u user -p dbname --master-data=2 > backup.sql
less backup.sql
this will give you the binlog file name and its position.
Restore the Backup:
mysql -h auroraendpoint -u user -p dbname < backup.sql
Enable replication:
CALL mysql.rds_set_external_master ('Master_RDS_EndPoint', 3306, 'Replication_user_name', 'Replication_User_password', 'BinLog_FileName', BingLog_Position, 0);
Strat replication:
call mysql.rds_start_replication;
Cutover:
During the maintenance window do a cutover and make the Aurora as a master.
call mysql.rds_stop_replication;
CALL mysql.rds_reset_external_master;
Related
So I am stuck with this error when trying to connect my node.js application with MySQL.
It won't let me connect to MySQL from localhost, not a single command is working.
The MySql workbench also says the same
I can't use any database commands since it's not letting me access mysql. Gone through almost all possible solutions on the internet none of them worked. Please help me out here even an explanation for this would help if not the solution.
In order to access you must do the following steps :
1. Run the terminate with user permission.
2. Access the path where you have mysql installed.
3. Put the following sentence.
mysql.exe -u root -ppasw
-u : It is the user.
-p : the password but next to the p without space.
If it does not work try this in windows cmd
To restore to a single concrete database.
mysqlbinlog -database='yourFile.00004'
Explanation : The Binary log.
It has replaced the old update file.
Its mission is to update the DBs during a recovery operation.
Replication masters are used as a reminder of the statements to be sent to the slave servers.
If the name is not specified, the host is chosen.
Performance drop of 1%.
Active bins must not be opened during execution.
If you put extension to the file, it is ignored.
A new BIN_LOG file is created when :
The server is restarted
A Flush binary Logs is made
The size specified in MAX_BINLOG_SIZE is exceeded.
The files that are generated have an extension that are sequential numbers and represent the order (index) of their creation controlled by the name host_name.index.
To activate and decomment the log-bin my.ini directive. If log-bin=file is used, that name will be used to name the sequence of files.
To delete index files.
purge binary before date-time (in this format "yyyy-mm-dd hh:mm:ss" or now() or interval....)
purge binary logs to filename; deletes up to this file (this one not included)
reset master -> deletes all files
To disable the binary log, the session variable is used.
SQL_LOG_BIN : Up to version 5.6 this one is
EXECUTE DB : binlog-do-db=BD
DOES NOT RUN DB : binlog-ignore-db=BD
The commands are the continuation of the binary log.
create database
alter database
drop database
To see the content of a binary file (must not be open).
mysqlbinlog "file with its path".
To restore several binary files must be done in one step.
mysqlbinlog file1 file2 file3 file3 | mysql -u root -ppassword
To restore.
Overwrite the file >
Adds in the content respecting the content >>
To restore to a single concrete database.
mysqlbinlog -database='filenamebinlog.00004'
If the above does not work, do this first
Another option
ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server
Cause :
mysql only has one root user, select MD5 after changing root password, then submit, reboot.
Login appears "The host 'localhost' is not allowed to connect to this MySQL server..."
Try the user table in another mysql library, overwrite, no, it is estimated that the version is different
Resolve :
Edit my.ini
Add a sentence to [mysqld]: skip-grant-tables
For example :
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-name-resolve
skip-grant-tables
The purpose is :
Bypass MySQL access control, anyone can log in to the MySQL database as an administrator in the console.
It should be noted that after changing the password, the MySQL server must be stopped and restarted to take effect.
Restart the mysql service!
I have installed some production, there is mysql embedded instance in production. Installation is successful, but when I tried to connect mysql instannce, I got following error messages.
[root#MiWiFi-R3D-srv bin]# ./mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/msql.sock' (2)
[root#MiWiFi-R3D-srv bin]#
[root#MiWiFi-R3D-srv bin]#
I can sure mysql instance is running.
aam 13390 1 0 08:01 ? 00:00:00 /bin/sh /opt/SIU_MANAGER/mysq /bin/mysqld_safe --defaults-file=/var/opt/SIU_MANAGER/mysql/my.cnf --pid-file=/var/opt/AAM/mysql/data/my.pid --ledir=/opt/AAM/mysql/bin --basedir=/opt/AAM/mysql --tmpdir=/var/opt/AAM/mysql/tmp/ --datadir=/var/opt/AAM/mysql/data --character-sets-dir=/opt/AAM/mysql/share/charsets/ --lc-messages-dir=/opt/AAM/mysql/share --lc-messages=en_US --user=bin
aam 13578 13390 0 08:01 ? 00:00:02 /opt/AAM/mysql/bin/mysqld --defaults-file=/var/opt/AAM/mysql/my.cnf --basedir=/opt/AAM/mysql --datadir=/var/opt/AAM/mysql/data --plugin-dir=/opt/AAM/mysql/lib/plugin --tmpdir=/var/opt/AAM/mysql/tmp/ --character-sets-dir=/opt/AAM/mysql/share/charsets/ --lc-messages-dir=/opt/AAM/mysql/share --lc-messages=en_US --log-error=MiWiFi-R3D-srv.err --pid-file=/var/opt/AAM/mysql/data/my.pid
root 17786 11762 0 08:27 pts/1 00:00:00 grep --color=auto mysql
I did little research. Mysql offical solution is that execute sql in mysql, but if I can not connect sql
I can not execute any sql.
Mysql offical solution https://dev.mysql.com/doc/mysql-security-excerpt/5.7/en/account-locking.html
When used with ALTER USER, these clauses specify the new locking state
for an existing account. In the absence of either clause, the account
locking state remains unchanged.
This is mysql version.
[root#MiWiFi-R3D-srv bin]# ./mysqladmin -V
./mysqladmin Ver 8.42 Distrib 5.7.25, for linux-glibc2.12 on x86_64
[root#MiWiFi-R3D-srv bin]#
How do I unlcok root user?
PS: I have root privillage of OS.
Thank you for answer me.
It looks like, for some reason, your communication socket for MySQL is being created in /tmp, and is presumably being deleted by some process that periodically cleans up /tmp.
You can get it back by restarting the mysqld process through whatever means is appropriate to your system.
You should also move it out of /tmp, perhaps into /var/run.
We have quite large (about 1TB) MySQL 5.7 DB, hosted on RDS. We want to migrate it to Aurora 5.6 - because of parallel queries (these are available only for 5.6).
It's not possible to do that by snapshot, because the version is not the same. We need to do mysqldump and then restore it.
I tried several options, but most of them always failed, because of the size of DB.
For example straight import
nohup mysqldump -h fmysql_5_7host.amazonaws.com -u user -pPass db_name | mysql -u user2 -pPAss2 -h aurora_5_6.amazonaws.com db_name
error in nohup.out :
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table
Also dump to s3 file failed
nohup mysqldump -h mysql_5_7host.amazonaws.com -u user -pPAss db_name | aws s3 cp - s3://bucket/db-dump.sql
error:
An error occurred (InvalidArgument) when calling the UploadPart operation: Part number must be an integer between 1 and 10000, inclusive
Both of previous methods worked for me on smaller DB, about 10GB, but not on 1TB.
Is there any other way how to migrate such database?
Many thanks.
After I upgraded MySQL 5.7 to MySQL 8.0, I started MySQL again and I got an error:The user specified as a definer ('mysql.infoschema'#'localhost') does not exist' when trying to dump tablespaces.
I don't understand why this problem occurs. And I want to know how to solve it
I had the same error when I accidentally downgraded my MySQL version from 8 to 5.7. At the first start the older version broke something so that version 8 was showing the error above.
In my case I had to enter the docker container where MySQL was running first
docker exec -it mysql bash
Then I basically followed the steps here
mysql -u root -p
mysql> SET GLOBAL innodb_fast_shutdown = 1;
mysql_upgrade -u root -p
This took some minutes but then everything was working again.
It may occur after some time after you set up your new system.
As a suggested solution, just try on Windows
1) open cmd.exe as Administrator
2) run mysql_upgrade.exe -uyour_user_name -pyour_password
mysql_upgrade.exe can be located at
C:\Program Files\MySQL\MySQL Server 8.0\bin
Then run the following to see if the infoschema user has appeared.
select user, host from mysql.user;
In my case, such error was caused by that I had changed the host of the dba user from % to localhost to strengthen the security.
I used "abcdba" with DDL right to create db schema, and used "abc" with CURD right for the Web service to use the DB. After the change, the read operations were OK but the write operations failed with the error message in the OP.
Flush privilege or restarting the server did not solve the problem. Then I changed to host of the dba user back to %. Then things have become normal again.
Apparently mysql does not like the changes of host of the dba user, and existing databases created by that dba user will have problem if the host of the dba user is changed.
Essentially, changing the host of the dba user is actually removing user abcdba#% and creating a new user abcdba#localhost. Here had come the error message, since abcdba#% and abcdba#localhost are 2 differently fully qualified usernames.
I’m trying to import a 4GB+ SQL to MySQL 5.6 (64-bit) on Windows 7 (64-bit)
The problem is I after a few seconds (), get this message:
ERROR 2006 (HY000) at line 204: MySQL server has gone away
It does import, but it only the first 3 tables (the first 2 and the 3rd table just the structure.
I’ve been trying this command:
mysql -u root -p firedb < C:\database_2013-11-12.sql
I tried a lot of things I could find here on stackoverflow with no success yet:
[mysqld]
innodb_file_per_table
max_allowed_packet=2048M
wait_timeout=3600
net_read_timeout=3600
net_buffer_length=3600
The SQL file was created on “MySQL 5.1.72-2-log (Debian)” using this command:
mysqldump -u root -p --all-databases
I have also tried setting --max_allowed_packet when running the command like this:
mysql --max_allowed_packet=2048M -u root -p --all-databases
The Documentation states:
The most common reason for the MySQL server has gone away error is
that the server timed out and closed the connection.
By default, the server closes the connection after eight hours if
nothing has happened. You can change the time limit by setting the
wait_timeout variable when you start mysqld. See Section 5.1.4,
“Server System Variables”.
If you have a script, you just have to issue the query again for the
client to do an automatic reconnection. This assumes that you have
automatic reconnection in the client enabled (which is the default for
the mysql command-line client).
So i would start with increasing the timeout.
And if this does not help read int he attached documentation link for the rest of reasons for server has gone away error.