Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
åäö in mysql problem
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4, 5  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Luddetiger
n00b
n00b


Joined: 11 Nov 2005
Posts: 25

PostPosted: Wed Feb 22, 2006 9:56 am    Post subject: åäö in mysql problem Reply with quote

After uppgrading mysql to verison 4.1.16 my swedish characters have stoped working.

Here is an example from a forum of mine:
"Här är mailet som har gått ut till er alla...."
where you can see that åäö dosn't work.

Can sombody please help me.

my my.cnf file:
Code:

# /etc/mysql/my.cnf: The global mysql configuration file.
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/my.cnf-4.1,v 1.2 2005/07/26 17:14:23 vivo Exp $

# The following options will be passed to all MySQL clients
[client]
password                                        = #####
port                                            = 3306
socket                                          = /var/run/mysqld/mysqld.sock

[mysql]
character-sets-dir=latin1
default-character-set=latin1

[mysqladmin]
character-sets-dir=latin1
default-character-set=latin1

[mysqlcheck]
character-sets-dir=latin1
default-character-set=latin1

[mysqldump]
character-sets-dir=latin1
default-character-set=latin1

[mysqlimport]
character-sets-dir=latin1
default-character-set=latin1

[mysqlshow]
character-sets-dir=latin1
default-character-set=latin1

[myisamchk]
character-sets-dir=latin1

[myisampack]
character-sets-dir=latin1

# use [safe_mysqld] with mysql-3
[mysqld_safe]
err-log                                         = /var/log/mysql/mysql.err

# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations.
[mysqld]
character-set-server            = latin1
default-character-set           = latin1
user                                            = mysql
port                                            = 3306
socket                                          = /var/run/mysqld/mysqld.sock
pid-file                                        = /var/run/mysqld/mysqld.pid
log-error                                       = /var/log/mysql/mysqld.err
basedir                                         = /usr
datadir                                         = /var/lib/mysql
skip-locking
#skip-innodb
key_buffer                                      = 16M

...


Back to top
View user's profile Send private message
JeliJami
Veteran
Veteran


Joined: 17 Jan 2006
Posts: 1086
Location: Belgium

PostPosted: Wed Feb 22, 2006 12:19 pm    Post subject: Reply with quote

something similar is already being discussed in https://forums.gentoo.org/viewtopic-t-436194.html
_________________
Unanswered Post Initiative | Search | FAQ
Former username: davjel
Back to top
View user's profile Send private message
Luddetiger
n00b
n00b


Joined: 11 Nov 2005
Posts: 25

PostPosted: Wed Feb 22, 2006 2:59 pm    Post subject: Reply with quote

It's dosen't sound like my problem.
More likley som problem in mysql...
Back to top
View user's profile Send private message
XtAzY
n00b
n00b


Joined: 18 Jan 2005
Posts: 23

PostPosted: Thu Feb 23, 2006 1:09 am    Post subject: Reply with quote

yes u are havin the same problem as i

my swedish characters dont work at all.... it display fine inside the mysql database, but when php access it it returns those characters
Back to top
View user's profile Send private message
Luddetiger
n00b
n00b


Joined: 11 Nov 2005
Posts: 25

PostPosted: Thu Feb 23, 2006 7:35 am    Post subject: Reply with quote

sadly...and you haven't found any solution?

I hate this..beacuse I know that I hade the exact same problem a bit back in the time.
Then I did somthing within mysql. I logged in and could there check somthing about the language. But what!!??

It was somthing with the settings in the my.cfn file.

Something with this:
[mysql]
character-sets-dir=latin1
default-character-set=latin1

but what?
Back to top
View user's profile Send private message
XtAzY
n00b
n00b


Joined: 18 Jan 2005
Posts: 23

PostPosted: Thu Feb 23, 2006 3:51 pm    Post subject: Reply with quote

i had mines set to utf8 but that doesnt work either. Followed the Gentoo utf guide and that does me no good either
Back to top
View user's profile Send private message
Bad Penguin
Guru
Guru


Joined: 18 Aug 2004
Posts: 507

PostPosted: Sat Feb 25, 2006 9:20 am    Post subject: Reply with quote

XtAzY wrote:
yes u are havin the same problem as i

my swedish characters dont work at all.... it display fine inside the mysql database, but when php access it it returns those characters


Does this help? http://php.net/manual/en/function.htmlentities.php

Do you have the mbstring extension set in php?
Back to top
View user's profile Send private message
XtAzY
n00b
n00b


Joined: 18 Jan 2005
Posts: 23

PostPosted: Sat Feb 25, 2006 9:55 pm    Post subject: Reply with quote

yes mbstring is set in php.ini....
Back to top
View user's profile Send private message
Bad Penguin
Guru
Guru


Joined: 18 Aug 2004
Posts: 507

PostPosted: Sun Feb 26, 2006 3:54 am    Post subject: Reply with quote

XtAzY wrote:
yes mbstring is set in php.ini....

Apparently character set support in php sucks (see item 2 at http://maurus.net/work/php-sucks/). I recall somewhere (perhaps a bug report) where the user was using glibc userlocales and only had en/utf8 installed. Do you have userlocales in your USE flags or package.use, and what does your /etc/locales.build look like?
Back to top
View user's profile Send private message
Luddetiger
n00b
n00b


Joined: 11 Nov 2005
Posts: 25

PostPosted: Mon Feb 27, 2006 11:58 am    Post subject: Reply with quote

my package.use file:

Code:

sys-libs/glibc userlocales


my /etc/locales.build file:

Code:

# This file names the list of locales to be built when glibc is installed.
# The format is <locale>/<charmap>, where <locale> is a locale from the
# /usr/share/i18n/locales directory, and <charmap> is name of one of the files
# in /usr/share/i18n/charmaps/. All blank lines and lines starting with # are
# ignored. Here is an example:
# en_US/ISO-8859-1

sv_SE/ISO-8859-1
sv_SE@euro/ISO-8859-15
sv_SE.UTF-8/UTF-8
no_NO/ISO-8859-1
no_NO@euro/ISO-8859-15
no_NO.UTF-8/UTF-8
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
ja_JP.EUC-JP/EUC-JP
ja_JP.UTF-8/UTF-8
ja_JP/EUC-JP
en_HK/ISO-8859-1
en_PH/ISO-8859-1
de_DE/ISO-8859-1
de_DE@euro/ISO-8859-15
es_MX/ISO-8859-1
fa_IR/UTF-8
fr_FR/ISO-8859-1
fr_FR@euro/ISO-8859-15
it_IT/ISO-8859-1


What is strange is that PHP can show åäö but not when getting information from the mysql. So I realy think the problem comes from the mysql


-----

If I enter my database in say Wemin I can see the ÅÄÖ chars

So it has to be a problem in between php and mysql...Some idea?
Back to top
View user's profile Send private message
Bad Penguin
Guru
Guru


Joined: 18 Aug 2004
Posts: 507

PostPosted: Mon Feb 27, 2006 2:35 pm    Post subject: Reply with quote

Luddetiger wrote:

If I enter my database in say Wemin I can see the ÅÄÖ chars

So it has to be a problem in between php and mysql...Some idea?

Well, this is beyond my experience at this point, all I can do is offer guesses. Since I have never used "non-standard" character sets I have never had to deal with it. Looking over php.ini I notice the [mbstring] section, perhaps that is one area you need to take a gander at, or perhaps do a search on "character" in php.ini. I am pretty sure you have to explicitely set the encoding options in your php scripts or the ini, somewhere.

Beyond that I am clueless, sorry. It seems since there are international forums here, someone who runs the gentoo forums would have a clue and be able to chime in.
Back to top
View user's profile Send private message
XtAzY
n00b
n00b


Joined: 18 Jan 2005
Posts: 23

PostPosted: Tue Feb 28, 2006 1:27 am    Post subject: Reply with quote

nothing is wrong if i test this in Windows while using the same script for php.ini and my.cnf
Back to top
View user's profile Send private message
Bad Penguin
Guru
Guru


Joined: 18 Aug 2004
Posts: 507

PostPosted: Tue Feb 28, 2006 3:05 pm    Post subject: Reply with quote

XtAzY wrote:
nothing is wrong if i test this in Windows while using the same script for php.ini and my.cnf

Have you tried comparing the output of phpinfo() from both environments?
Back to top
View user's profile Send private message
XtAzY
n00b
n00b


Joined: 18 Jan 2005
Posts: 23

PostPosted: Tue Feb 28, 2006 11:43 pm    Post subject: Reply with quote

yes and they are nearly identical
Back to top
View user's profile Send private message
indynet
Tux's lil' helper
Tux's lil' helper


Joined: 07 Feb 2005
Posts: 108
Location: Prague - Czech Republic

PostPosted: Wed Mar 01, 2006 12:00 am    Post subject: Reply with quote

Bad Penguin wrote:
Luddetiger wrote:

If I enter my database in say Wemin I can see the ÅÄÖ chars

So it has to be a problem in between php and mysql...Some idea?

Well, this is beyond my experience at this point, all I can do is offer guesses. Since I have never used "non-standard" character sets I have never had to deal with it. Looking over php.ini I notice the [mbstring] section, perhaps that is one area you need to take a gander at, or perhaps do a search on "character" in php.ini. I am pretty sure you have to explicitely set the encoding options in your php scripts or the ini, somewhere.

Beyond that I am clueless, sorry. It seems since there are international forums here, someone who runs the gentoo forums would have a clue and be able to chime in.


Hi,

Im not sure if it should be solution for your problem but you could try it...

Code:

<?php
mysql_connect();
mysql_query("SET CHARACTER SET xxxx");
?>


where xxxx should be utf8,cp1251_koi8... - code page of your website, for performance is very good solution have same as database

That you setup code page for transfer...
Back to top
View user's profile Send private message
Bad Penguin
Guru
Guru


Joined: 18 Aug 2004
Posts: 507

PostPosted: Wed Mar 01, 2006 2:00 am    Post subject: Reply with quote

XtAzY wrote:
yes and they are nearly identical

Uh, nearly?

What are the differences?
Back to top
View user's profile Send private message
XtAzY
n00b
n00b


Joined: 18 Jan 2005
Posts: 23

PostPosted: Wed Mar 01, 2006 3:20 am    Post subject: Reply with quote

well wutever it is i dunt think its the php problems

heres wut i found out when i ran SHOW VARIABLES in mysql

i notices the character_set_client.... and others are mixed up with latin1 and utf8.... i prefer latin1 since it works on my old server b4

Code:

mysql> SHOW variables;
+---------------------------------+-------------------------------------------------------------+
| Variable_name | Value |
+---------------------------------+-------------------------------------------------------------+
| back_log | 50 |
| basedir | /usr/ |
| bdb_cache_size | 8388600 |
| bdb_home | |
| bdb_log_buffer_size | 0 |
| bdb_logdir | |
| bdb_max_lock | 10000 |
| bdb_shared_data | OFF |
| bdb_tmpdir | |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql-401/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
| concurrent_insert | ON |
| connect_timeout | 5 |
| datadir | /var/lib/mysql-401/ |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| default_week_format | 0 |
| delay_key_write | ON |
| delayed_insert_limit | 100 |
| delayed_insert_timeout | 300 |
| delayed_queue_size | 1000 |
| expire_logs_days | 0 |
| flush | OFF |
| flush_time | 0 |
| ft_boolean_syntax | + -><()~*:""&| |
| ft_max_word_len | 84 |
| ft_min_word_len | 4 |
| ft_query_expansion_limit | 20 |
| ft_stopword_file | (built-in) |
| group_concat_max_len | 1024 |
| have_archive | YES |
| have_bdb | DISABLED |
| have_blackhole_engine | YES |
| have_compress | YES |
| have_crypt | YES |
| have_csv | YES |
| have_example_engine | NO |
| have_geometry | YES |
| have_innodb | DISABLED |
| have_isam | NO |
| have_ndbcluster | NO |
| have_openssl | YES |
| have_query_cache | YES |
| have_raid | YES |
| have_rtree_keys | YES |
| have_symlink | YES |
| init_connect | |
| init_file | |
| init_slave | |
| innodb_additional_mem_pool_size | 2097152 |
| innodb_autoextend_increment | 8 |
| innodb_buffer_pool_awe_mem_mb | 0 |
| innodb_buffer_pool_size | 16777216 |
| innodb_data_file_path | ibdata1:10M:autoextend |
| innodb_data_home_dir | |
| innodb_fast_shutdown | ON |
| innodb_file_io_threads | 4 |
| innodb_file_per_table | OFF |
| innodb_flush_log_at_trx_commit | 1 |
| innodb_flush_method | |
| innodb_force_recovery | 0 |
| innodb_lock_wait_timeout | 50 |
| innodb_locks_unsafe_for_binlog | OFF |
| innodb_log_arch_dir | |
| innodb_log_archive | OFF |
| innodb_log_buffer_size | 8388608 |
| innodb_log_file_size | 5242880 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | |
| innodb_max_dirty_pages_pct | 90 |
| innodb_max_purge_lag | 0 |
| innodb_mirrored_log_groups | 1 |
| innodb_open_files | 300 |
| innodb_table_locks | ON |
| innodb_thread_concurrency | 8 |
| interactive_timeout | 28800 |
| join_buffer_size | 131072 |
| key_buffer_size | 16777216 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
| language | /usr/share/mysql-401/english/ |
| large_files_support | ON |
| license | GPL |
| local_infile | ON |
| locked_in_memory | OFF |
| log | OFF |
| log_bin | ON |
| log_error | /var/log/mysql-401/mysqld.err |
| log_slave_updates | OFF |
| log_slow_queries | OFF |
| log_update | OFF |
| log_warnings | 1 |
| long_query_time | 10 |
| low_priority_updates | OFF |
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
| max_allowed_packet | 16776192 |
| max_binlog_cache_size | 4294967295 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 100 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20 |
| max_join_size | 4294967295 |
| max_length_for_sort_data | 1024 |
| max_relay_log_size | 0 |
| max_seeks_for_key | 4294967295 |
| max_sort_length | 1024 |
| max_tmp_tables | 32 |
| max_user_connections | 0 |
| max_write_lock_count | 4294967295 |
| myisam_data_pointer_size | 4 |
| myisam_max_extra_sort_file_size | 2147483648 |
| myisam_max_sort_file_size | 2147483647 |
| myisam_recover_options | OFF |
| myisam_repair_threads | 1 |
| myisam_sort_buffer_size | 8388608 |
| myisam_stats_method | nulls_unequal |
| net_buffer_length | 8192 |
| net_read_timeout | 30 |
| net_retry_count | 10 |
| net_write_timeout | 60 |
| new | OFF |
| old_passwords | OFF |
| open_files_limit | 1024 |
| pid_file | /var/run/mysqld/mysqld-401.pid |
| port | 3306 |
| preload_buffer_size | 32768 |
| protocol_version | 10 |
| query_alloc_block_size | 8192 |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 0 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
| query_prealloc_size | 8192 |
| range_alloc_block_size | 2048 |
| read_buffer_size | 258048 |
| read_only | OFF |
| read_rnd_buffer_size | 520192 |
| relay_log_purge | ON |
| relay_log_space_limit | 0 |
| rpl_recovery_rank | 0 |
| secure_auth | OFF |
| server_id | 1 |
| skip_external_locking | ON |
| skip_networking | OFF |
| skip_show_database | OFF |
| slave_net_timeout | 3600 |
| slave_transaction_retries | 0 |
| slow_launch_time | 2 |
| socket | /var/run/mysqld/mysqld.sock |
| sort_buffer_size | 524280 |
| sql_mode | |
| sql_notes | ON |
| sql_warnings | ON |
| storage_engine | MyISAM |
| sync_binlog | 0 |
| sync_frm | ON |
| sync_replication | 0 |
| sync_replication_slave_id | 0 |
| sync_replication_timeout | 0 |
| system_time_zone | EST |
| table_cache | 64 |
| table_type | MyISAM |
| thread_cache_size | 0 |
| thread_stack | 196608 |
| time_format | %H:%i:%s |
| time_zone | SYSTEM |
| tmp_table_size | 33554432 |
| tmpdir | /tmp/ |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| tx_isolation | REPEATABLE-READ |
| version | 4.1.18-log |
| version_bdb | Sleepycat Software: Berkeley DB 4.1.24: (February 21, 2006) |
| version_comment | Gentoo Linux mysql-4.1.18-r30 |
| version_compile_machine | i686 |
| version_compile_os | pc-linux-gnu |
| wait_timeout | 28800 |
+---------------------------------+-------------------------------------------------------------+

could that be the problem?
i tried to SET character_set_client=latin1; and so on...on the command line in mysql.... but it has no affect even though it said the query was ok

on my old server it was this

Code:

| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
--------------------------------------------------------------------------------
Back to top
View user's profile Send private message
spottraining
n00b
n00b


Joined: 30 Jan 2005
Posts: 73
Location: Estonia

PostPosted: Thu Apr 13, 2006 5:27 am    Post subject: Reply with quote

I have also problem after updating.
In MySQL tables all äöü-s are fine. Also in PHP (languages files) But in forums and others web sites are all missed.
I have checked my my.cnf file - but this is same what it was. I have change the characters to utf8 - still nothing.

I only updated my MySQL from 4.1.14 to 4.1.14-r1
Also I getting errors in phpBB, when in post is some ä,ö,ü:
Code:
Could not insert new word matches

DEBUG MODE

SQL Error : 1267 Illegal mix of collations (latin1_bin,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ' IN '

INSERT INTO phpbb_search_wordmatch (post_id, word_id, title_match) SELECT 5025, word_id, 1 FROM phpbb_search_wordlist WHERE word_text IN ('äääööö')
Line : 251
File : functions_search.php



I need help :(

Code:
mysql> SHOW VARIABLES;
+---------------------------------+----------------------------------------------------------+
| Variable_name | Value |
+---------------------------------+----------------------------------------------------------+
| back_log | 50 |
| basedir | /usr/ |
| bdb_cache_size | 8388600 |
| bdb_home | /var/lib/mysql/ |
| bdb_log_buffer_size | 32768 |
| bdb_logdir | |
| bdb_max_lock | 10000 |
| bdb_shared_data | OFF |
| bdb_tmpdir | /tmp/ |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
| concurrent_insert | ON |
| connect_timeout | 5 |
| datadir | /var/lib/mysql/ |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| default_week_format | 0 |
| delay_key_write | ON |
| delayed_insert_limit | 100 |
| delayed_insert_timeout | 300 |
| delayed_queue_size | 1000 |
| expire_logs_days | 0 |
| flush | OFF |
| flush_time | 0 |
| ft_boolean_syntax | + -><()~*:""&| |
| ft_max_word_len | 84 |
| ft_min_word_len | 4 |
| ft_query_expansion_limit | 20 |
| ft_stopword_file | (built-in) |
| group_concat_max_len | 1024 |
| have_archive | NO |
| have_bdb | YES |
| have_blackhole_engine | NO |
| have_compress | YES |
| have_crypt | YES |
| have_csv | NO |
| have_example_engine | NO |
| have_geometry | YES |
| have_innodb | YES |
| have_isam | NO |
| have_ndbcluster | NO |
| have_openssl | YES |
| have_query_cache | YES |
| have_raid | NO |
| have_rtree_keys | YES |
| have_symlink | YES |
| init_connect | |
| init_file | |
| init_slave | |
| innodb_additional_mem_pool_size | 2097152 |
| innodb_autoextend_increment | 8 |
| innodb_buffer_pool_awe_mem_mb | 0 |
| innodb_buffer_pool_size | 16777216 |
| innodb_data_file_path | ibdata1:10M:autoextend |
| innodb_data_home_dir | |
| innodb_fast_shutdown | ON |
| innodb_file_io_threads | 4 |
| innodb_file_per_table | OFF |
| innodb_flush_log_at_trx_commit | 1 |
| innodb_flush_method | |
| innodb_force_recovery | 0 |
| innodb_lock_wait_timeout | 50 |
| innodb_locks_unsafe_for_binlog | OFF |
| innodb_log_arch_dir | |
| innodb_log_archive | OFF |
| innodb_log_buffer_size | 8388608 |
| innodb_log_file_size | 5242880 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | ./ |
| innodb_max_dirty_pages_pct | 90 |
| innodb_max_purge_lag | 0 |
| innodb_mirrored_log_groups | 1 |
| innodb_open_files | 300 |
| innodb_table_locks | ON |
| innodb_thread_concurrency | 8 |
| interactive_timeout | 28800 |
| join_buffer_size | 131072 |
| key_buffer_size | 16777216 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
| language | /usr/share/mysql/english/ |
| large_files_support | ON |
| license | GPL |
| local_infile | ON |
| locked_in_memory | OFF |
| log | OFF |
| log_bin | ON |
| log_error | /var/log/mysql/mysqld.err |
| log_slave_updates | OFF |
| log_slow_queries | OFF |
| log_update | OFF |
| log_warnings | 1 |
| long_query_time | 10 |
| low_priority_updates | OFF |
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
| max_allowed_packet | 1047552 |
| max_binlog_cache_size | 4294967295 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 100 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20 |
| max_join_size | 4294967295 |
| max_length_for_sort_data | 1024 |
| max_relay_log_size | 0 |
| max_seeks_for_key | 4294967295 |
| max_sort_length | 1024 |
| max_tmp_tables | 32 |
| max_user_connections | 0 |
| max_write_lock_count | 4294967295 |
| myisam_data_pointer_size | 4 |
| myisam_max_extra_sort_file_size | 2147483648 |
| myisam_max_sort_file_size | 2147483647 |
| myisam_recover_options | OFF |
| myisam_repair_threads | 1 |
| myisam_sort_buffer_size | 8388608 |
| net_buffer_length | 8192 |
| net_read_timeout | 30 |
| net_retry_count | 10 |
| net_write_timeout | 60 |
| new | OFF |
| old_passwords | OFF |
| open_files_limit | 1024 |
| pid_file | /var/run/mysqld/mysqld.pid |
| port | 3306 |
| preload_buffer_size | 32768 |
| protocol_version | 10 |
| query_alloc_block_size | 8192 |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 0 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
| query_prealloc_size | 8192 |
| range_alloc_block_size | 2048 |
| read_buffer_size | 258048 |
| read_only | OFF |
| read_rnd_buffer_size | 520192 |
| relay_log_purge | ON |
| relay_log_space_limit | 0 |
| rpl_recovery_rank | 0 |
| secure_auth | OFF |
| server_id | 1 |
| skip_external_locking | ON |
| skip_networking | OFF |
| skip_show_database | OFF |
| slave_net_timeout | 3600 |
| slave_transaction_retries | 0 |
| slow_launch_time | 2 |
| socket | /var/run/mysqld/mysqld.sock |
| sort_buffer_size | 524280 |
| sql_mode | |
| storage_engine | MyISAM |
| sql_notes | ON |
| sql_warnings | ON |
| sync_binlog | 0 |
| sync_replication | 0 |
| sync_replication_slave_id | 0 |
| sync_replication_timeout | 0 |
| sync_frm | ON |
| system_time_zone | EEST |
| table_cache | 64 |
| table_type | MyISAM |
| thread_cache_size | 0 |
| thread_stack | 196608 |
| time_format | %H:%i:%s |
| time_zone | SYSTEM |
| tmp_table_size | 33554432 |
| tmpdir | /tmp/ |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| tx_isolation | REPEATABLE-READ |
| version | 4.1.14-log |
| version_bdb | Sleepycat Software: Berkeley DB 4.1.24: (April 12, 2006) |
| version_comment | Gentoo Linux mysql-4.1.14-r1 |
| version_compile_machine | i686 |
| version_compile_os | pc-linux-gnu |
| wait_timeout | 28800 |
+---------------------------------+----------------------------------------------------------+
192 rows in set (0.01 sec)

_________________
Sorry about bad English - I am learning....

The box said Windows XP or better, so I installed Linux
Back to top
View user's profile Send private message
wandra
n00b
n00b


Joined: 24 May 2005
Posts: 25

PostPosted: Thu Apr 13, 2006 8:47 am    Post subject: Re: åäö in mysql problem Reply with quote

after going from mysal-4.1.14 -> 4.1.14-r1
I have exactly the same problem --- really ugly to view

http://sos.primavista.net/
http://www.lapalma24.org/


[quote="Luddetiger"]After uppgrading mysql to verison 4.1.16 my swedish characters have stoped working.

Here is an example from a forum of mine:
"Här är mailet som har gått ut till er alla...."
where you can see that åäö dosn't work.

Can sombody please help me.
Back to top
View user's profile Send private message
Luddetiger
n00b
n00b


Joined: 11 Nov 2005
Posts: 25

PostPosted: Thu Apr 13, 2006 8:51 am    Post subject: Reply with quote

I think it is the r1 version that creates the mess...so go back to ordinary version
Back to top
View user's profile Send private message
torenvalk
n00b
n00b


Joined: 13 Apr 2006
Posts: 2

PostPosted: Thu Apr 13, 2006 9:02 am    Post subject: Reply with quote

The same problem here. I recently upgraded from 4.1.14 to 4.1.14-r1. I am using Mediawiki on my site. Before the mysql upgrade everything worked fine. After the upgrade all special chars like äöü-s etc. show up as two characters, mostly something that looks like the A and a second varying character. When I look into the database with phpMyAdmin I also see these character instead of the correct ones. I'm also using another database that contains special characters. These show up just fine. I read somewhere that mediawiki somehow stores unicode characters binary in latin1 encoded fields. Perhaps this has something to do with the issue. phpBB might do the same, but I don't know that.

Maybe recompiling php solves the problem?
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Thu Apr 13, 2006 10:30 am    Post subject: Reply with quote

Recompiling PHP won't solve the problem.
Take a look at https://bugs.gentoo.org/show_bug.cgi?id=129761, we're working on this, it's mainly a PHP problem, that it doesn't read my.cnf, so if you people have latin1 databases and set the charset to latin1 in my.cnf, mysql* will correctly interpret that and use latin1, but PHP will use utf8 (compiled in default) as connection charset, screwing up the special characters... So we're working on a fix on the PHP side, to make it read my.cnf too.
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
torenvalk
n00b
n00b


Joined: 13 Apr 2006
Posts: 2

PostPosted: Thu Apr 13, 2006 10:48 am    Post subject: Reply with quote

Is there a way to covert existing latin1 databases to utf8 in such a way that php interprets the characters in the right way?
Back to top
View user's profile Send private message
SoylentGreen
l33t
l33t


Joined: 19 Aug 2005
Posts: 904
Location: The Hostel

PostPosted: Thu Apr 13, 2006 11:12 am    Post subject: Reply with quote

well, thats what i call a big boboo, because 4.1.14-r1 breaks phpBB ;(
depending on how i set the language in phpBB langfile, I either cant type in "umlaute", or otherwise i am unable to login as admin, i get "invalid_session" ??!?

well, shit happens, but why the heck did you guys remove 4.1.14 8O
i simply would have switched back and am fine. but now.. hmm.. just downgrading to 4.0.something ;(

//edit: thankfully i found a backup of 4.1.14 - duh! downgradeing to 4.0 is not a good idea ;(
Back to top
View user's profile Send private message
SoylentGreen
l33t
l33t


Joined: 19 Aug 2005
Posts: 904
Location: The Hostel

PostPosted: Thu Apr 13, 2006 11:24 am    Post subject: 4.1.14 ebuild Reply with quote

Code:

# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-4.1.14.ebuild,v 1.34 2006/03/24 16:03:07 vivo Exp $

inherit eutils gnuconfig flag-o-matic versionator

SVER=${PV%.*}
NEWP="${PN}-${PV}"
#NEWP="${NEWP/_beta/-beta}"


# shorten the path because the socket path length must be shorter than 107 chars
# and we will run a mysql server during test phase
S="${WORKDIR}/${PN}"

DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
HOMEPAGE="http://www.mysql.com/"
SRC_URI="mirror://mysql/Downloads/MySQL-${SVER}/${NEWP}.tar.gz
   mirror://gentoo/mysql-extras-20050920.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86"
IUSE="big-tables berkdb debug doc minimal perl readline selinux ssl static tcpd"
RESTRICT="primaryuri"

DEPEND="readline? ( >=sys-libs/readline-4.1 )
   berkdb? ( sys-apps/ed )
   tcpd? ( >=sys-apps/tcp-wrappers-7.6-r6 )
   ssl? ( >=dev-libs/openssl-0.9.6d )
   perl? ( dev-lang/perl )
   userland_GNU? ( sys-process/procps )
   >=sys-libs/zlib-1.2.3
   >=sys-apps/texinfo-4.7-r1
   >=sys-apps/sed-4"
RDEPEND="${DEPEND} selinux? ( sec-policy/selinux-mysql )"
# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"

if version_is_at_least "4.1.3" ; then
   IUSE="${IUSE} cluster utf8 geometry extraengine"
fi

mysql_upgrade_error() {
   ewarn "Sorry, plain up/downgrade between different version of MySQL is (still)"
   ewarn "un-supported."
   ewarn "Some gentoo documentation on how to do it:"
   ewarn "http://www.gentoo.org/doc/en/mysql-upgrading.xml"
   ewarn "Also on the MySQL website:"
   ewarn "http://dev.mysql.com/doc/refman/4.1/en/upgrading-from-4-0.html"
   ewarn ""
   ewarn "You can also choose to preview some new MySQL 4.1 behaviour"
   ewarn "adding a section \"[mysqld-4.0]\" followed by the word \"new\""
   ewarn "into /etc/mysql/my.cnf (you need a recent MySQL version)"
   ewarn ""

}

mysql_upgrade_warning() {
   ewarn "If you're upgrading from MySQL-3.x to 4.0, or 4.0.x to 4.1.x, you"
   ewarn "must recompile the other packages on your system that link with"
   ewarn "libmysqlclient after the upgrade completes.  To obtain such a list"
   ewarn "of packages for your system, you may use:"
   ewarn "revdep-rebuild --library=libmysqlclient.so.12"
   ewarn "from app-portage/gentoolkit."
   ewarn ""
   ewarn "the value of \"innodb_log_file_size\" into /etc/mysql/my.cnf file "
   ewarn "has changed size from \"8M\" to \"5M\"."
   ewarn "To start mysql either revert the value back to \"8M\" or backup and"
   ewarn "remove the old ib_logfile* from the datadir"
}

mysql_get_datadir() {
   DATADIR=""
   if [ -f '/etc/mysql/my.cnf' ] ; then
      #DATADIR=`/usr/sbin/mysqld  --help |grep '^datadir' | awk '{print $2}'`
      #DATADIR=`my_print_defaults mysqld | grep -- '^--datadir' | tail -n1 | sed -e 's|^--datadir=||'`
      DATADIR=`my_print_defaults mysqld 2>/dev/null | sed -ne '/datadir/s|^--datadir=||p' | tail -n1`
      if [ -z "${DATADIR}" ]; then
         DATADIR=`grep ^datadir /etc/mysql/my.cnf | sed -e 's/.*= //'`
         einfo "Using default DATADIR"
      fi
   fi
   if [ -z "${DATADIR}" ]; then
      DATADIR="/var/lib/mysql/"
      einfo "Using default DATADIR"
   fi
   einfo "MySQL DATADIR is ${DATADIR}"

   if [ -z "${PREVIOUS_DATADIR}" ] ; then
      if [ -a "${DATADIR}" ] ; then
         ewarn "Previous datadir found, it's YOUR job to change"
         ewarn "ownership and have care of it"
         PREVIOUS_DATADIR="yes"
         export PREVIOUS_DATADIR
      else
         PREVIOUS_DATADIR="no"
         export PREVIOUS_DATADIR
      fi
   fi

   export DATADIR
}

pkg_setup() {

   if [[ -z $MYSQL_STRAIGHT_UPGRADE ]] ; then
      mysql_get_datadir
      local curversion="dev-db/${PN}-${PV%.*}"
      local oldversion="$(best_version dev-db/mysql)"
      oldversion=${oldversion%.*}

      # permit upgrade from old version if it's safe
      useq minimal && oldversion=""
      built_with_use dev-db/mysql minimal && oldversion=""
      [[ -d "${DATADIR}/mysql" ]] || oldversion=""

      if [[ -n "${oldversion}" ]] && [[ "${oldversion}" != "${curversion}" ]]
      then
         mysql_upgrade_error
         eerror "MySQL-${oldversion} found, up/downgrade to \"${curversion}\" is unsupported"
         eerror "export MYSQL_STRAIGHT_UPGRADE=1 to force"
         die
      fi
   fi

   mysql_upgrade_warning

   enewgroup mysql 60 || die "problem adding group mysql"
   enewuser mysql 60 -1 /dev/null mysql \
   || die "problem adding user mysql"

}

src_unpack() {
   if useq static && useq ssl; then
      local msg="MySQL does not support building statically with SSL support"
      eerror "${msg}"
      die "${msg}"
   fi

   if version_is_at_least "4.1.3" \
   && useq cluster \
   || useq geometry \
   || useq extraengine \
   && useq minimal ; then
      die "USEs cluster, geometry, extraengine conflicts with \"minimal\""
   fi

   unpack ${A} || die

   mv "${WORKDIR}/${NEWP}" "${S}"
   cd "${S}"
   rm -rf "${S}/zlib/"*.[ch]
   sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in"

   local MY_PATCH_SOURCE="${WORKDIR}/mysql-extras"

   epatch ${MY_PATCH_SOURCE}/010_all_my-print-defaults-r0.patch || die
   epatch ${MY_PATCH_SOURCE}/030_all_thrssl-r1.patch || die
   epatch ${MY_PATCH_SOURCE}/035_x86_asm-pic-fixes-r7.patch || die
   epatch ${MY_PATCH_SOURCE}/040_all_tcpd-vars-fix.patch || die

   for d in ${S} ${S}/innobase; do
      cd ${d}
      # WARNING, plain autoconf breaks it!
      #autoconf
      # must use this instead
      WANT_AUTOCONF="2.59" autoreconf --force
      # Fix the evil "libtool.m4 and ltmain.sh have a version mismatch!"
      libtoolize --copy --force
      # Saving this for a rainy day, in case we need it again
      #WANT_AUTOMAKE=1.7 automake
      gnuconfig_update
   done

   # Temporary workaround for bug in test suite, a correct solution
   # should work inside the include files to enable/disable the tests
   # for the current configuration

   if ! useq extraengine ; then
      einfo "disabling unneded extraengine tests"
      local disable_test="archive bdb blackhole federated view csv"
      for i in $disable_test ; do
         mv "${S}/mysql-test/t/${i}.test" "${S}/mysql-test/t/${i}.disabled" \
         &> /dev/null
      done
   fi


   if ! useq berkdb ; then
      einfo "disabling unneded berkdb tests"
      local disable_test="auto_increment bdb-alter-table-1 bdb-alter-table-2 bdb-crash bdb-deadlock bdb bdb_cache binlog ctype_sjis ctype_utf8 heap_auto_increment index_merge_bdb multi_update mysqldump ps_1general ps_6bdb rowid_order_bdb"
      for i in $disable_test ; do
         mv "${S}/mysql-test/t/${i}.test" "${S}/mysql-test/t/${i}.disabled" \
         &> /dev/null
      done
   fi
}

src_compile() {
   local myconf

   # readline pair reads backwards on purpose, DONT change it around, Ok?
   # this is because it refers to the building of a bundled readline
   # versus the system copy
   useq readline && myconf="${myconf} --without-readline"
   useq readline || myconf="${myconf} --with-readline"

   if useq static ; then
      myconf="${myconf} --with-mysqld-ldflags=-all-static"
      myconf="${myconf} --with-client-ldflags=-all-static"
      myconf="${myconf} --disable-shared"
   else
      myconf="${myconf} --enable-shared --enable-static"
   fi

   myconf="${myconf} `use_with tcpd libwrap`"

   if useq ssl ; then
      # --with-vio is not needed anymore, it's on by default and
      # has been removed from configure
      version_is_at_least "5.0.4_beta" || myconf="${myconf} --with-vio"
      if version_is_at_least "5.0.6_beta" ; then
         # yassl-0.96 is young break with gcc-4.0 || amd64
         #myconf="${myconf} --with-yassl"
         myconf="${myconf} --with-openssl"
      else
         myconf="${myconf} --with-openssl"
      fi
   else
      myconf="${myconf} --without-openssl"
   fi

   if useq debug; then
      myconf="${myconf} --with-debug=full"
   else
      myconf="${myconf} --without-debug"
      version_is_at_least "4.1.3" && useq cluster && myconf="${myconf} --without-ndb-debug"
   fi

   # benchmarking stuff needs perl
   # and shouldn't be bothered with on minimal builds
   if useq perl && ! useq minimal; then
      myconf="${myconf} --with-bench"
   else
      myconf="${myconf} --without-bench"
   fi

   # these are things we exclude from a minimal build
   # note that the server actually does get built and installed
   # but we then delete it before packaging.
   local minimal_exclude_list="server embedded-server extra-tools innodb"
   if ! useq minimal; then
      for i in ${minimal_exclude_list}; do
         myconf="${myconf} --with-${i}"
      done

      if useq static ; then
         myconf="${myconf} --without-raid"
         ewarn "disabling raid support, has problem with static"
      else
         myconf="${myconf} --with-raid"
      fi

      if ! version_is_at_least "5.0_alpha" ; then
         if version_is_at_least "4.1_alpha" && useq utf8; then
            myconf="${myconf} --with-charset=utf8"
            myconf="${myconf} --with-collation=utf8_general_ci"
         else
            myconf="${myconf} --with-charset=latin1"
            myconf="${myconf} --with-collation=latin1_swedish_ci"
         fi
      fi

      # lots of chars
      myconf="${myconf} --with-extra-charsets=all"

      #The following fix is due to a bug with bdb on sparc's. See:
      #http://www.geocrawler.com/mail/msg.php3?msg_id=4754814&list=8
      # it comes down to non-64-bit safety problems
      if useq sparc || useq alpha || useq hppa || useq mips || useq amd64
      then
         myconf="${myconf} --without-berkeley-db"
      else
         useq berkdb \
            && myconf="${myconf} --with-berkeley-db=./bdb" \
            || myconf="${myconf} --without-berkeley-db"
      fi

      if version_is_at_least "4.1.3" ; then
         myconf="${myconf} $(use_with geometry)"
         myconf="${myconf} $(use_with cluster ndbcluster)"
      fi

      version_is_at_least "4.1.11_alpha20050403" &&  myconf="${myconf} --with-big-tables"
   else
      for i in ${minimal_exclude_list}; do
         myconf="${myconf} --without-${i}"
      done
      myconf="${myconf} --without-berkeley-db"
      myconf="${myconf} --with-extra-charsets=none"
   fi

   # documentation
   myconf="${myconf} `use_with doc docs`"

   if version_is_at_least "4.1.3" && useq extraengine; then
      # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html
      myconf="${myconf} --with-archive-storage-engine"
      # http://dev.mysql.com/doc/mysql/en/csv-storage-engine.html
      version_is_at_least "4.1.4" \
      && myconf="${myconf} --with-csv-storage-engine"
      # http://dev.mysql.com/doc/mysql/en/federated-description.html
      # http://dev.mysql.com/doc/mysql/en/federated-limitations.html
      if version_is_at_least "5.0.3" ; then
         einfo "before to use federated engine be sure to read"
         einfo "http://dev.mysql.com/doc/mysql/en/federated-limitations.html"
         myconf="${myconf} --with-federated-storage-engine"
      fi
      version_is_at_least "4.1.11_alpha20050403" \
      &&  myconf="${myconf} --with-blackhole-storage-engine"
   fi

   myconf="${myconf} `use_with big-tables`"

   #glibc-2.3.2_pre fix; bug #16496
   append-flags "-DHAVE_ERRNO_AS_DEFINE=1"

   #the compiler flags are as per their "official" spec ;)
   #CFLAGS="${CFLAGS/-O?/} -O3" \
   export CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-exceptions -fno-rtti"
   version_is_at_least "5.0_alpha" \
   && export CXXFLAGS="${CXXFLAGS} -fno-implicit-templates"

   econf \
      --libexecdir=/usr/sbin \
      --sysconfdir=/etc/mysql \
      --localstatedir=/var/lib/mysql \
      --with-low-memory \
      --enable-assembler \
      --enable-local-infile \
      --with-mysqld-user=mysql \
      --with-client-ldflags=-lstdc++ \
      --enable-thread-safe-client \
      --with-comment="Gentoo Linux ${PF}" \
      --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
      --with-lib-ccflags="-fPIC" \
      ${myconf} || die "bad ./configure"

   emake || die "compile problem"
}

src_test() {
   cd ${S}
   einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
   make check || die "make check failed"
   if ! useq minimal; then
      einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
      local retstatus
      addpredict /this-dir-does-not-exist/t9.MYI

      # Temporary removed, 4.1.14 use mysql-test-run.pl instead
      # of mysql-test-run, thus failing on test that should be
      # skipped.
      #version_is_at_least "5.0.6_beta" \
      #&& make test-force \
      #|| make test

      # <replace me whenever possible>
      cd mysql-test; ./mysql-test-run && ./mysql-test-run --ps-protocol
      retstatus=$?
      cd ..
      # </replace me whenever possible>

      # to be sure ;)
      pkill -9 -f "${S}/ndb" 2>/dev/null
      pkill -9 -f "${S}/sql" 2>/dev/null
      [[ $retstatus -eq 0 ]] || die "make test failed"
   else
      einfo "Skipping server tests due to minimal build."
   fi
}

src_install() {
   mysql_get_datadir
   make install DESTDIR="${D}" benchdir_root="/usr/share/mysql" || die

   # move client libs, install a couple of missing headers
   local lib=$(get_libdir)
   mv ${D}/usr/${lib}/mysql/libmysqlclient*.so* ${D}/usr/${lib}
   dosym ../libmysqlclient.so /usr/${lib}/mysql/libmysqlclient.so
   dosym ../libmysqlclient_r.so /usr/${lib}/mysql/libmysqlclient_r.so
   insinto /usr/include/mysql ; doins include/{my_config.h,my_dir.h}

   # convenience links
   dosym /usr/bin/mysqlcheck /usr/bin/mysqlanalyze
   dosym /usr/bin/mysqlcheck /usr/bin/mysqlrepair
   dosym /usr/bin/mysqlcheck /usr/bin/mysqloptimize

   # various junk
   rm -f ${D}/usr/bin/make*distribution
   rm -f ${D}/usr/share/mysql/make_*_distribution
   rm -f ${D}/usr/share/mysql/mysql.server
   rm -f ${D}/usr/share/mysql/binary-configure
   rm -f ${D}/usr/share/mysql/mysql-log-rotate
   rm -f ${D}/usr/share/mysql/{post,pre}install
   rm -f ${D}/usr/share/mysql/mi_test*
   rm -f ${D}/usr/share/mysql/*.spec # Redhat gunk
   rm -f ${D}/usr/share/mysql/*.plist # Apple gunk
   rm -f ${D}/usr/share/mysql/my-*.cnf # Put them elsewhere

   # All of these (ab)use Perl.
   if ! useq perl; then
      rm -f ${D}/usr/bin/{mysqlhotcopy,mysql_find_rows,mysql_convert_table_format,mysqld_multi,mysqlaccess,mysql_fix_extensions,mysqldumpslow,mysql_zap,mysql_explain_log,mysql_tableinfo,mysql_setpermission}
      rm -f ${D}/usr/bin/mysqlhotcopy
      rm -rf ${D}/usr/share/mysql/sql-bench
   fi

   # clean up stuff for a minimal build
   # this is anything server-specific
   if useq minimal; then
      rm -rf ${D}/usr/share/mysql/{mysql-test,sql-bench}
      rm -f ${D}/usr/bin/{mysql_install_db,mysqlmanager*,mysql_secure_installation,mysql_fix_privilege_tables,mysqlhotcopy,mysql_convert_table_format,mysqld_multi,mysql_fix_extensions,mysql_zap,mysql_explain_log,mysql_tableinfo,mysqld_safe,myisam*,isam*,mysql_install,mysql_waitpid,mysqlbinlog,mysqltest,pack_isam}
      rm -f ${D}/usr/sbin/mysqld
      rm -f ${D}/usr/lib/mysql/lib{heap,merge,nisam,mysys,mystrings,mysqld,myisammrg,vio,dbug,myisam}.a
   fi

   # config stuff
   insinto /etc/mysql
   doins scripts/mysqlaccess.conf

   newins "${FILESDIR}/my.cnf-4.1" my.cnf

   if version_is_at_least "4.1.3" && ! useq utf8; then
      sed --in-place -e "s/utf8/latin1/" \
         ${D}/etc/mysql/my.cnf
   fi

   # minimal builds don't have the server
   if ! useq minimal; then
      exeinto /etc/init.d
      newexe "${FILESDIR}/mysql-4.0.24-r2.rc6" mysql
      insinto /etc/logrotate.d
      newins "${FILESDIR}/logrotate.mysql" mysql

      #empty dirs...
      diropts "-m0750"
      if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then
         dodir "${DATADIR}"
         keepdir "${DATADIR}"
         chown -R mysql:mysql "${D}/${DATADIR}"
      fi

      diropts "-m0755"
      dodir "/var/log/mysql"
      #touch ${D}/var/log/mysql/mysql.{log,err}
      #chmod 0660 ${D}/var/log/mysql/mysql.{log,err}
      keepdir "/var/log/mysql"
      chown -R mysql:mysql "${D}/var/log/mysql"

      diropts "-m0755"
      dodir "/var/run/mysqld"

      keepdir "/var/run/mysqld"
      chown -R mysql:mysql "${D}/var/run/mysqld"
   fi

   # docs
   dodoc README COPYING ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE
   # minimal builds don't have the server
   if useq doc && ! useq minimal; then
      dohtml Docs/*.html
      dodoc Docs/manual.{txt,ps}
      docinto conf-samples
      dodoc support-files/my-*.cnf
   fi
}

pkg_preinst() {
   enewgroup mysql 60 || die "problem adding group mysql"
   enewuser mysql 60 -1 /dev/null mysql \
   || die "problem adding user mysql"
}

pkg_postinst() {
   mysql_get_datadir

   # mind at FEATURES=collision-protect before to remove this
   #empty dirs...
   [ -d "${ROOT}/var/log/mysql" ] \
      || install -d -m0755 -o mysql -g mysql ${ROOT}/var/log/mysql

   #secure the logfiles... does this bother anybody?
   touch ${ROOT}/var/log/mysql/mysql.{log,err}
   chown mysql:mysql ${ROOT}/var/log/mysql/mysql*
   chmod 0660 ${ROOT}/var/log/mysql/mysql*
   # secure some directories
   chmod 0750 ${ROOT}/var/log/mysql

   if ! useq minimal; then
      # your friendly public service announcement...
      einfo
      einfo "You might want to run:"
      einfo "\"emerge --config =${PF}\""
      einfo "if this is a new install."
      einfo
   fi

   mysql_upgrade_warning
   einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream."
}

pkg_config() {
   mysql_get_datadir

   if built_with_use dev-db/mysql minimal; then
      die "Minimal builds do NOT include the MySQL server"
   fi

   if [[ "$(pgrep mysqld)" != "" ]] ; then
      die "Oops you already have a mysql daemon running!"
   fi

   local pwd1="a"
   local pwd2="b"
   local maxtry=5

   if [[ -d "${ROOT}/${DATADIR}/mysql" ]] ; then
      ewarn "You have already a MySQL database in place."
      ewarn "Please rename it or delete it if you wish to replace it."
      die "MySQL database already exists!"
   fi

   einfo "Creating the mysql database and setting proper"
   einfo "permissions on it..."

   einfo "Insert a password for the mysql 'root' user"
   ewarn "Avoid [\"'\\_%] characters in the password"

   read -rsp "    >" pwd1 ; echo
   einfo "Check the password"
   read -rsp "    >" pwd2 ; echo

   if [[ "x$pwd1" != "x$pwd2" ]] ; then
      die "Passwords are not the same"
   fi

   ${ROOT}/usr/bin/mysql_install_db || die "MySQL databases not installed"

   # MySQL 5.0 don't need this
   chown -R mysql:mysql ${ROOT}/${DATADIR}
   chmod 0750 ${ROOT}/${DATADIR}

   local options=""
   local sqltmp="$(emktemp)"
   local help_tables="${ROOT}/usr/share/mysql/fill_help_tables.sql"

   if version_is_at_least "4.1.3" ; then
      options="--skip-ndbcluster"

      # Filling timezones, see
      # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
      ${ROOT}/usr/bin/mysql_tzinfo_to_sql ${ROOT}/usr/share/zoneinfo \
      > "${sqltmp}"

      if [[ -r "${help_tables}" ]] ; then
         cat "${help_tables}" >> "${sqltmp}"
      fi
   fi

   local socket=${ROOT}/var/run/mysqld/mysqld.sock
   local mysqld="${ROOT}/usr/sbin/mysqld \
      ${options} \
      --skip-grant-tables \
      --basedir=${ROOT}/usr \
      --datadir=${ROOT}/${DATADIR} \
      --skip-innodb \
      --skip-bdb \
      --max_allowed_packet=8M \
      --net_buffer_length=16K \
      --socket=${socket} \
      --pid-file=${ROOT}/var/run/mysqld/mysqld.pid"

   $mysqld &
   while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]]
   do
      maxtry=$(($maxtry-1))
      echo -n "."
      sleep 1
   done

   # do this from memory we don't want clear text password in temp files
   local sql="UPDATE mysql.user SET Password = PASSWORD('${pwd1}') WHERE USER='root'"
   ${ROOT}/usr/bin/mysql \
      --socket=${ROOT}/var/run/mysqld/mysqld.sock \
      -hlocalhost \
      -e "${sql}"

   einfo "Loading \"zoneinfo\" this step may require few seconds"

   ${ROOT}/usr/bin/mysql \
      --socket=${socket} \
      -hlocalhost \
      -uroot \
      -p"${pwd1}" \
      mysql < "${sqltmp}"

   kill $( cat ${ROOT}/var/run/mysqld/mysqld.pid )
   rm  "${sqltmp}"
   einfo "done"
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2, 3, 4, 5  Next
Page 1 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum