Percona pt-online-schema-change failing to alter table - mysql

I am trying to use the pt-online-schema-change to change the data size in a table. I am trying to increase the name column to varchar(30)
pt-online-schema-change D=clients,t=client_types --alter "CHANGE `name` `name` varchar(30)" --dry-run;
I am getting a few errors.
-bash: name: command not found
Then it seems like the command executes but ultimately fails.
Operation, tries, wait:
analyze_table, 10, 1
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Starting a dry run. `clients`.`client_types` will not be altered. Specify --execute instead of --dry-run to alter the table.
Creating new table...
Created new table clients._client_types_new OK.
Altering new table...
2019-10-08T13:43:40 Dropping new table...
2019-10-08T13:43:40 Dropped new table OK.
Dry run complete. `clients`.`client_types` was not altered.
Error altering new table `clients`.`_client_types_new`: DBD::mysql::db do failed: 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 'varchar(30)' at line 1 [for Statement "ALTER TABLE `clients`.`_client_types_new` CHANGE varchar(30)"] at /usr/bin/pt-online-schema-change line 9194.
I am using mysql Ver 14.14

This fixed my issue. pt-online-schema-change --dry-run --alter "modify name varchar(30)" D=client,t=client_types;

Related

Bugzilla installation error with MySQL version 8.0

Getting an error with creating database with latest MySQL version 8.0 for Bugzilla installation.
I'm setting up a new server for Bugzilla with below configuration.
Bugzilla version : 5.0.6
Strawberry PERL version : 5.28.2.1
MySQL version : 8.0
My current setup is working fine with older version of MySQL 5.7.27. But somehow have to migrate to newer version of MySQL 8.0 and with this I'm getting an error while creating table entry in database.
On google, what I found is that something related to 'GROUPS'. This keyword is reserved in MySQL 8.0 and bugzilla trying to use that keyword. I don't have a knowledge of MySQL so I couldn't figured out this problem.
Below is the output of checksetup.pl
....
....
Checking for DBD-mysql (v4.001) ok: found v4.050
Checking for MySQL (v5.0.15) ok: found v8.0.17
Adding new table bz_schema...
Initializing bz_schema...
Creating tables...
Converting attach_data maximum size to 100G...
Setting up choices for standard drop-down fields:
priority op_sys resolution bug_status rep_platform bug_severity
Creating ./data directory...
Creating ./data/assets directory...
Creating ./data/attachments directory...
Creating ./data/db directory...
Creating ./data/extensions directory...
Creating ./data/mining directory...
Creating ./data/webdot directory...
Creating ./graphs directory...
Creating ./skins/custom directory...
Creating ./data/extensions/additional...
Creating ./data/mailer.testfile...
Creating ./Bugzilla/.htaccess...
Creating ./data/.htaccess...
Creating ./data/assets/.htaccess...
Creating ./data/attachments/.htaccess...
Creating ./data/webdot/.htaccess...
Creating ./graphs/.htaccess...
Creating ./lib/.htaccess...
Creating ./template/.htaccess...
Creating contrib/.htaccess...
Creating t/.htaccess...
Creating xt/.htaccess...
Precompiling templates...done.
DBD::mysql::db selectrow_array failed: 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 'groups where name = ''' at line 1 [for Statement "SELECT id FROM groups where name = ''"] at Bugzilla/Install/DB.pm line 2497.
Bugzilla::Install::DB::_fix_group_with_empty_name() called at Bugzilla/Install/DB.pm line 358
Bugzilla::Install::DB::update_table_definitions(HASH(0x34e8cb8)) called at checksetup.pl line 175
Starting from Mysql 8.0 groups is reserved word. Conseqently 'groups' cannot be the table name. You can fix it by putting backticks around the table name groups in bugzilla code.
Groups can still be used, however, you need to add the database name in front of every call to the "GROUPS" table. In the case of Bugzilla standard install, the database name is 'bugs'. Example from line 1643 in DB.pm:
$dbh->do("ALTER TABLE groups DROP PRIMARY KEY");
Changed to:
$dbh->do("ALTER TABLE bugs.groups DROP PRIMARY KEY");
There are about a dozen SQL statements that make a call to that table in DB.pm. You will have to add it to all of them.
Try this:
SELECT id FROM database_name.groups where name = ''

Syntax error received when trying to source a file from mysql command line

I have a file that is filled with statements that appear like the following:
update table set column1=NULL where column2 in (select id from users where user_id in ('user1','user2'));
As you can see this is correct syntax. When I run this command manually on the mysql command line it works as intended.
However when I attempt to source the file I get syntax errors. Has anyone seen this issue before? I'm looking for a resolution...
mysql> \! source /tmp/update_users.sql
/tmp/update_users.sql: line 2: syntax error near unexpected token `('
/tmp/update_users.sql: line 2: `(select id from users where user_id in ('user1','user2'));'
You have to use the MySQL source command:
mysql> source /tmp/update_users.sql
When you use \!, you instead invoke a shell command. The shell source command expects a shell script, not a sql file.

Did anyone get pgloader to work for migration from Mysql to Postgres

I have installed pgloader using yum install on centos 6.5. I cannot get pgloader to load the following file. My command on the shell is pgloader mysql.load
LOAD DATABASE
from mysql://root:pass123#127.0.0.1:7777/demomysql
into postgresql://postgres:postgres#127.0.0.1:5432/dbname?demopsql
WITH include drop, create tables, no truncate,
create indexes, reset sequences, foreign keys
SET maintenance_work_mem to '128MB', work_mem to '12MB', search_path to 'demopsql'
CAST type datetime to timestamptz
drop default drop not null using zero-dates-to-null,
type date drop not null drop default using zero-dates-to-null
-- MATERIALIZE VIEWS film_list, staff_list
-- INCLUDING ONLY TABLE NAMES MATCHING ~/film/, 'actor'
-- EXCLUDING TABLE NAMES MATCHING ~<ory>
BEFORE LOAD DO
$$ create schema if not exists demopsql; $$;
I get the following log file
pgloader INFO Logger initialized
pgloader WARNING path entry '/usr/share/python-support/pgloader/reformat' does not exists, ignored
pgloader INFO Reformat path is []
pgloader INFO Will consider following sections:
pgloader INFO
pgloader INFO All threads are started, wait for them to terminate
The warning is due to a bug.
Search for he variable DEFAULT_REFORMAT_PATH in /usr/share/pyshared/pgloader/options.py
Replace the path given with
/usr/share/pyshared/reformat.
You also have an error on the the file: dbname?demopsql should be demopsql

Installing Bugzilla 4.2.5 with Mysql 5.6.11

So now I am getting to the final steps of completing the Bugzilla install. I keep getting
'disabledtext' can't have a default value.
This is the complete error.
*Initializing "Dependency Tree Changes" email_setting ...
Updating column disabledtext in table profiles ...
Old: mediumtext DEFAULT '' NOT NULL
New: mediumtext NOT NULL
DBD::mysql::db do failed: BLOB/TEXT column 'disabledtext' can't have a default value [for Statement "ALTER TABLE profiles ALTER COLUMN disabledtext DROP DEFAULT"] at Bugzilla/DB.pm line 729.
Bugzilla::DB::bz_alter_column_raw('Bugzilla::DB::Mysql=HASH(0x6e8f7f0)', 'profiles', 'disabledtext', 'HASH(0xa0a73d0)', 'HASH(0xa0be4a8)', undef) called at Bugzilla/DB.pm line 688
Bugzilla::DB::bz_alter_column('Bugzilla::DB::Mysql=HASH(0x6e8f7f0)', 'profiles', 'disabledtext', 'HASH(0xa0a73d0)') called at Bugzilla/Install/DB.pm line 505
Bugzilla::Install::DB::update_table_definitions('HASH(0x30d53d0)') called at ./checksetup.pl line 199*
Is the actual error in Bugzilla/Install/DB.pm?
Very new at this stuff so any would be great.
Bugzilla = 4.2.5
Mysql = 5.6.11
OS = Suse 12
There was an active bug filed for MySQL 5.6 and Bugzilla 4.2.5 and lower where mySQL 5.6 was not supported and causing a bunch of issues. The bug report is linked the the release notes below.
But to resolve your issue, you can either downgrade MySQL to a 5.5 series or lower, or upgrade BugZilla. BugZilla 4.2.6 was released on May 22nd that provides support for MySQL 5.6, see the release notes linked off of this page.
My advice is to upgrade BugZilla to 4.2.6.

Can't create tables in MySQL workbench

I've just installed MySQL workbench on my computer and have importend an old database into the system which seems to be working find. All the data is there and tables. I can do select, insert, updates etc.
However, if I expand a database, I see tables, views, routines. If I then right click on tables, nothing happens if I click create table... However, if I manually type in the create sql command, it creates a table just fine.
The old laptop has:
OS: Ubuntu 10.04.3
MySQL: 5.1.41
MySQL Workbench: 5.2.33
The new laptop has:
OS: Ubuntu 10.04.3
MySQL: 5.1.41
MySQL Workbench: 5.2.37
I have also tried starting mysql workbench using sudo mysql-workbench and I get the same problem.
However, it does give the following output at command line if I start it from the command line on the new laptop:
oshirowanen#laptop:~$ mysql-workbench
Ready.
** Message: query.save_edits built-in command is being overwritten
** Message: query.discard_edits built-in command is being overwritten
** (mysql-workbench-bin:2737): CRITICAL **: murrine_style_draw_box: assertion `height >= -1' failed
(mysql-workbench-bin:2737): glibmm-CRITICAL **:
unhandled exception (type Glib::Error) in signal handler:
domain: gtk-builder-error-quark
code : 6
what : Unknown internal child: selection
(mysql-workbench-bin:2737): glibmm-CRITICAL **:
unhandled exception (type Glib::Error) in signal handler:
domain: gtk-builder-error-quark
code : 6
what : Unknown internal child: selection
oshirowanen#laptop:~$
On the old laptop I get:
oshirowanen#laptop:~$ mysql-workbench
Log levels '0111000'
disabling log level 0
enabling log level 1
enabling log level 2
enabling log level 3
disabling log level 4
disabling log level 5
disabling log level 6
Ready.
Any idea why I can't create tables using the mouse?
this is a known issue with Ubuntu 10.04:
go to:
/usr/share/mysql-workbench/modules/data/editor_mysql_table_live.glade
and delete all the nodes that look like this:
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection5"/>
</child>