Friday, March 5, 2010

Checking if MYSQL is 32Bits or 64Bits?

Do you know MYSQL installed on your system is MYSQL 32Bit or MYSQL 64Bit.


You can achieve this in Different Ways. The best command i found was "file"

Find the MYSQLD location

# which mysqld
/bin/mysqld


# file /bin/mysqld
/bin/mysqld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped


FOR 64 Bit this would show

# file /bin/mysqld
/usr/sbin/mysqld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped


The other way to find is using mysql to find it
MYSQL on 32 Bit System

mysql> SHOW GLOBAL VARIABLES LIKE 'version_compile_machine';
+-------------------------+-------+
| Variable_name | Value |
+-------------------------+-------+
| version_compile_machine | i686 |
+-------------------------+-------+
1 row in set (0.00 sec)


MYSQL on 64 Bit System
mysql> show variables like 'version_compile_machine';
+-------------------------+--------+
| Variable_name | Value |
+-------------------------+--------+
| version_compile_machine | x86_64 |
+-------------------------+--------+


We can also check if the mysqld binary are linked to which library
MYSQL on 32bit System
[root@localhost ~]# ldd /bin/mysqld
linux-gate.so.1 => (0x00df0000)
libpthread.so.0 => /lib/libpthread.so.0 (0x007cf000)
libdl.so.2 => /lib/libdl.so.2 (0x007c9000)
librt.so.1 => /lib/librt.so.1 (0x007fd000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x0490d000)
libnsl.so.1 => /lib/libnsl.so.1 (0x0032e000)
libm.so.6 => /lib/libm.so.6 (0x007a0000)
libc.so.6 => /lib/libc.so.6 (0x0065a000)
/lib/ld-linux.so.2 (0x00637000)


MYSQL on 64 Bit System
# ldd /usr/local/mysql/libexec/mysqld
linux-vdso.so.1 => (0x00007fff6d5ff000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007ff3650d3000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007ff364ebc000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007ff364bb0000)
libdl.so.2 => /lib/libdl.so.2 (0x00007ff3649ac000)
librt.so.1 => /lib/librt.so.1 (0x00007ff3647a3000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007ff36456b000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00007ff364353000)
libm.so.6 => /lib/libm.so.6 (0x00007ff3640d0000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007ff363eb9000)
libc.so.6 => /lib/libc.so.6 (0x00007ff363b66000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff3652ef000)


Another Method is using "ELFREAD"
MYSQL on 32 Bit System

[root@localhost ~]# readelf -h /bin/mysqld
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0x81805a0
Start of program headers: 52 (bytes into file)
Start of section headers: 39507760 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 44
Section header string table index: 41


MYSQL on 64 Bit System

[root@localhost ~]# readelf -h /bin/mysqld
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x4e5a30
Start of program headers: 64 (bytes into file)
Start of section headers: 7548008 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 9
Size of section headers: 64 (bytes)
Number of section headers: 32
Section header string table index: 31

1 comment:

  1. [...] posted here: Checking if MYSQL is 32Bits or 64Bits? Posted in: Education ADD [...]

    ReplyDelete