Monday, September 23, 2013

[how to] How and where do I upload a mysql database?

[how to] How and where do I upload a mysql database?


How and where do I upload a mysql database?

Posted: 23 Sep 2013 08:28 PM PDT

I am new to Ubuntu (server edition) and mysql.

How do I upload (import) an existing database with a MYSQL or (mysql.zip) extension that was downloaded from a web host (cPanel?)

I do not have any of the UI bells and whistles such as zPanel (although I tried to install it.) I did install phpMyAdmin with Ubunto but I do not know how to access it from a remote computer )In the past, I only used it with cPanel.)

My site will reside in /var/www.

I have installed mysql server Dist. 5.5.32. Thanks. :)

my.cnf configuration for 1and1 XL8 Server 8 core cpu and 8gig ram

Posted: 23 Sep 2013 05:09 PM PDT

I am trying to tweak my server's my.cnf file because I have been receiving numerous "too many connection" warnings when doing database back ups among other things. I know I also need to tweak other aspects of my server as well.

Here is my my.cnf

[mysqld]  #bind-address=127.0.0.1  #skip-bdb  local-infile=0  max_connections=90  open_files_limit=2050  datadir=/var/lib/mysql  socket=/var/lib/mysql/mysql.sock  user=mysql  # Disabling symbolic-links is recommended to prevent assorted security risks  symbolic-links=0  query_cache_limit = 12M  query_cache_size = 55M  join_buffer_size = 512K  read_buffer_size = 128K  tmp_table_size = 3024M  thread_cache_size = 4  table_cache = 6024  innodb_buffer_pool_size = 540M  key_buffer_size = 1024M  table_definition_cache = 4024  max_allowed_packet = 35M  max_heap_table_size = 3024M  [mysqld_safe]  log-error=/var/log/mysqld.log  pid-file=/var/run/mysqld/mysqld.pid  

Here is my basic server specs--

AMD Opteron™ 4274

8 Cores x 2.5 GHz (3.5 Turbo Core)

16 GB DDR3 ECC

Running Cent os and the latest Plesk Panel

Currently this server has 1 fairly busy Vbulletin site, 1 fairly small Vbulletin site and 4 other very small and not busy WordPress sites

Updated

[mysqld]  #bind-address=127.0.0.1  #skip-bdb  local-infile=0  max_connections=500  open_files_limit=9975  datadir=/var/lib/mysql  socket=/var/lib/mysql/mysql.sock  user=mysql  # Disabling symbolic-links is recommended to prevent assorted security risks  symbolic-links=0  query_cache_limit = 12M  query_cache_size = 55M  join_buffer_size = 512K  read_buffer_size = 128K  thread_cache_size = 50  table_cache = 3024  innodb_buffer_pool_size = 6G  key_buffer_size = 32M  table_definition_cache = 4096  max_allowed_packet = 40M  tmp-table-size = 32M  max-heap-table-size = 32M  [mysqld_safe]  log-error=/var/log/mysqld.log  pid-file=/var/run/mysqld/mysqld.pid  

Here is mysql tuner output

 >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>   >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/   >>  Run with '--help' for additional options and output filtering    -------- General Statistics --------------------------------------------------  [--] Skipped version check for MySQLTuner script  [OK] Currently running supported MySQL version 5.1.69  [OK] Operating on 64-bit architecture    -------- Storage Engine Statistics -------------------------------------------  [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster  [--] Data in MyISAM tables: 4G (Tables: 3307)  [--] Data in InnoDB tables: 111M (Tables: 487)  [--] Data in MEMORY tables: 248K (Tables: 329)  [!!] Total fragmented tables: 653    -------- Security Recommendations  -------------------------------------------  [OK] All database users have passwords assigned    -------- Performance Metrics -------------------------------------------------  [--] Up for: 2m 30s (3K q [25.700 qps], 166 conn, TX: 106M, RX: 1M)  [--] Reads / Writes: 83% / 17%  [--] Total buffers: 6.1G global + 3.1M per thread (500 max threads)  [OK] Maximum possible memory usage: 7.6G (48% of installed RAM)  [OK] Slow queries: 0% (0/3K)  [OK] Highest usage of available connections: 0% (4/500)  [OK] Key buffer size / total MyISAM indexes: 32.0M/526.3M  [OK] Key buffer hit rate: 98.3% (102K cached / 1K reads)  [OK] Query cache efficiency: 68.8% (2K cached / 3K selects)  [OK] Query cache prunes per day: 0  [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 171 sorts)  [!!] Joins performed without indexes: 8  [!!] Temporary tables created on disk: 28% (33 on disk / 114 total)  [OK] Thread cache hit rate: 97% (4 created / 166 connections)  [OK] Table cache hit rate: 96% (182 open / 189 opened)  [OK] Open file limit used: 3% (337/9K)  [OK] Table locks acquired immediately: 100% (1K immediate / 1K locks)  [OK] InnoDB data size / buffer pool: 111.6M/6.0G    -------- Recommendations -----------------------------------------------------      General recommendations:      Run OPTIMIZE TABLE to defragment tables for better performance      MySQL started within last 24 hours - recommendations may be inaccurate      Enable the slow query log to troubleshoot bad queries      Adjust your join queries to always utilize indexes      When making adjustments, make tmp_table_size/max_heap_table_size equal      Reduce your SELECT DISTINCT queries without LIMIT clauses  Variables to adjust:      join_buffer_size (> 512.0K, or always use indexes with joins)      tmp_table_size (> 32M)      max_heap_table_size (> 32M)  

Keep in mind I just ran this script after installing. It should probably run for 24 hours before a real output..

MySQL memory usage issues?

Posted: 23 Sep 2013 03:42 PM PDT

I have a MySQL instance running on my Ubuntu server that is eating up most of the memory on the machine. I currently have 2 GB of ram installed on the machine, and MySQL is using 1983 MB.

Most of my experience is with SQL Development so I'm a little unsure about how to go about freeing up memory. So far I've tried running FLUSH TABLES; but that didn't really do anything. I also ran some diagnostic queries, but am not sure what to make of them:

SHOW ENGINE INNODB STATUS;    ----------------------  BUFFER POOL AND MEMORY  ----------------------  Total memory allocated 22114338; in additional pool allocated 1048576  Dictionary memory allocated 1061936  Buffer pool size   512  Free buffers       0  Database pages     510  Modified db pages  33  Pending reads 0  Pending writes: LRU 0, flush list 0, single page 0  Pages read 12944231, created 26985, written 3625935  2.17 reads/s, 0.00 creates/s, 0.00 writes/s  Buffer pool hit rate 976 / 1000      select sum(data_length+index_length) from information_schema.tables where engine='memory';  +-------------------------------+  | sum(data_length+index_length) |  +-------------------------------+  |                             0 |  +-------------------------------+  

Can anyone make any suggestions about how to free up memory and prevent MySQL from eating up all memory on the server with the information I have provided? If I haven't provided enough info here, any suggestions on what I should look at next to diagnose the problem?

SSMS command to disconnect after query has finished

Posted: 23 Sep 2013 03:09 PM PDT

In SQL Server Management Studio, is there any way (for example a SQLCMD command or something) to get the SQL script window to automatically disconnect as soon as the query has finished executing?

moving database from old disk to new disk

Posted: 23 Sep 2013 01:49 PM PDT

I need to move a database from an old disk which is no longer bootable to a new bootable disk. I have been able to mount the old disk. Now I need to move the database from there to a new disk. Can this be done? Where do I start and what do I need to move?

Extract data from Access fields and print them to specific fields in a text file [on hold]

Posted: 23 Sep 2013 01:14 PM PDT

I have an Access file with several tables. Each of these tables have various fields with data in them. I need to extract this data from the database file and print them on various fields in a text file. Please tell me how to do that.

Using Mirroring to upgrade SQL Server 2008 R2 to SQL Server 2012

Posted: 23 Sep 2013 01:10 PM PDT

I am attempting to mirror a SQL Server 2008 R2 database currently in a fail over with the purpose of doing an in place upgrade. I have installed SQL Server 2012 on another machine to serve as my secondary and SQL Server 2012 Express Edition on a third server to serve as my witness. All of the servers are able to communicate with each other on the specified ports via telnet.

The databases all use mixed mode authentication and when installing the SQL Server the same domain accounts were used for the services the SQL Server uses.(Server Agent and the Server itself) The user I am using for the mirror is on the domain, set up as a local admin to the servers, and sysadmin to the SQL Servers.

I have followed several guides on how to set up the mirror. When I use the wizard to try to do this it completes all of the steps and says success on setting up the endpoints. I click on start mirroring and it states that it is unable to connect to the 2012 installation (the server network address "tcp://2012Installation.domain:port" can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational(Microsoft SQL Server, Error: 1418)).

I have copied all of the network addresses and they work with telnet, as well as having the firewalls down. In addition, the 2012 Installation's database cannot be dropped as it is set up for mirroring. I have followed all of the recommendations here to no avail. The server it is saying it cannot communicate with is the 2012 SQL, which I am trying to mirror stuff too. It is also the box I am using SQL Management Studio on.

What I think may be the issue is that the original 2008 SQL Server was part of a failover cluster, so it has two different names.(One for the cluster and one for the server itself) It appears as though the mirroring stuff is trying to use the cluster name. I have tried using an alter statement to change the listening partner to the server name itself, but that did not work either. Does any one have any idea why this would not work?

SQL Server 2012 - Full Text Search [Break word - Underscore]

Posted: 23 Sep 2013 06:15 PM PDT

Let's say I want to search for a list containing 'PS3':

SELECT * FROM [TABLE] WHERE CONTAINS(Title, 'PS3')  

When the Title is proceeded by an underscore it will not return it.

  1. Oblivion-PS3 -> Good
  2. Oblivion PS3 -> Good
  3. Oblivion_PS3 -> Not returning

I suppose the underscore is not a break word.

How can I fix it so that the underscore can be used as a break word?

Installing Oracle 11gR2 on Oracle Linux 6 - error possibly related to database (unique) name

Posted: 23 Sep 2013 12:48 PM PDT

Installing 11gR2 on Oracle Linux 6.4. System is a desktop used by one developer. It's on DHCP. Hostname is similar to ip-t3400-1547.mydomain.local

Please note I have no issues installing this software on systems with fixed IP address, where the hostname is a solid alphanumeric string (no dashes).

I am loosely following:

I've installed the package oracle-rdbms-server-11gR2-preinstall, which takes care of many pre-install tasks. I've set SELinux to permissive. Quote from /home/oracle/.bash_profile:

export ORACLE_BASE=/u01/app/oracle  export ORACLE_SID=joe  export ORACLE_UNQNAME=joe  export ORACLE_HOSTNAME=ip-t3400-1547  umask 022  

"joe" is the owner of the machine, so I'm using his name as the SID (real name edited for privacy). Please note that everything described below happens with or without ORACLE_UNQNAME being set here.

I select Server Class, Single Instance, Advanced Install, Enterprise Edition, General Purpose configuration type, then:

Global database name: joe  Oracle Service Identifier: joe  

The above parameters, and the variables in .bash_profile, are different when installing on a system with a fixed IP address. In that case, I set ORACLE_HOSTNAME to the actual hostname of the machine (e.g.: dbserver13.mydomain.local), ORACLE_UNQNAME to the hostname (dbserver13), and SID same as UNQNAME (dbserver13). Works great.

I cannot do that on the DHCP-based workstation, because our naming convention includes the dash character in the hostname, which is not accepted by the installer for all those parameters.

I believe this difference is what causes the installer to fail, but I can't figure out an alternative.

I have tried to add "joe" and "joe.mydomain.local" to /etc/hosts, on the loopback entry (beginning with 127.0.0.1) but it makes no difference.

Character Sets: Unicode. Select Use Database Control, notifications disabled.

Some pre-requisite packages fail the check, but this is fine.

The installer keeps chugging along, then towards the end it throws this warning:

enter image description here

Enterprise manager configuration succeeded with the following warning -    Error starting Database Control. Please execute the following command(s).    1) Set the enrvironment variable ORACLE_UNQNAME to Database unique name    2) /u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl start dbconsole  

The problem is, I have that variable set already. It makes no difference.

As a result, the installer only asks me to run one post-install script, instead of the usual two scripts. The Web UI doesn't seem to work.

I am obviously doing something wrong.

How should I choose all those database names and SIDs and whatnot, in a way that allows me to install 11gR2 on a DHCP-based desktop?

connection pooling, transactions, nested transaction and rollback

Posted: 23 Sep 2013 12:49 PM PDT

I've got strange behavior on production.

First user request thru application failed, I've got SQLServerException with "Lock request time out period exceeded." After that following requests are successfully executed. After some time I've closed client application and all requests disappeared. I know that requests were successfully executed because I have JDBC logging on my client application.

Is there any other possible scenario other than nested transactions and rollback?

Connection pooling uses same spid (session) when it's possible so that must have been the case here.

Every request is just one stored procedure which has explicit transaction defined. I'm not sure how this could happened because transaction would either be committed or rollback because of this block.

begin try      begin tran      set lock_timeout x      ...      commit tran    end try    begin catch      if @@trancount > 0        rollback tran      ...    end catch  

Also, would it be wise to add on start just after "begin try" rollback tran if @@trancount > 0? That way I would prevent future issues like this.

Note, yes, I know that SQL Server doesn't have nested transactions and I don't use them. I'm mentioning them because I don't see other way that this could happened. Thanks!

how to create backup for update tables structures in existing DB?

Posted: 23 Sep 2013 12:33 PM PDT

I have Sql Server DB, I know I can Create thru "Generate Scripts" backup for SP and Functions then I just replace inside the script the "CREATE" with "ALTER", that will update the target DB with the latest Functions And SP but how to do that for Tables structures and "User Defined Tables" ?

mysql: Access denied messages

Posted: 23 Sep 2013 06:13 PM PDT

I have just installed ubuntu on my server and mysql.

I can't make any change in mysql (seeting password, creating database, etc.) as I ALWAYS get an Access denied error message. I have followed the mysql manuals re passwords, but to no avail.

The user name I use is the account name created when ubuntu was installed.

At some point, I am told I need SUPER privileges to do this or that but I can't change the privileges since I get the same error message. I can't even see the GRANTS as I also get the same access denied message. mysql version 14.14 Dist. 5.5.32, for debian-linux-gnu

Any idea on how to solve this?

To Arka:

Editing my own question is the only option I have to post this:

mysql> status    mysql Ver 14.14 Distrib 5.5.32, for debian-linux-gnu (i686) using readline 6.2  Connection id: 63  Current database:  Current user: charles@localhost  SSL: Not in use  Current pager: stdout  Using outfile: ''  Using delimiter: ;  Server version: 5.5.32-0ubuntu0.12.04.1 (Ubuntu)  Protocol version: 10  Connection: localhost via UNIX socket  Server characterset: latin1  Db characterset: latin1  Client characterset: utf8  Conn. characterset: utf8  UNIX socket: /var/run/mysqld/mysqld.sock  Uptime: 6 hours 58 min 20 sec  Threads: 1   Questions: 165   Slow queries: 0   Opens: 211   Flush tables: 1   Open tables: 51   Queries per second avg: 0.006  

Now, I have not been able to create a single database since the installation of the server this morning. I hope that helps. Thanks. :)

Options for Data Encryption in SQL Server 2008 R2 Standard Edition?

Posted: 23 Sep 2013 01:08 PM PDT

I'm helping a friend with setting up encryption of data on SQL Server 2008 R2 Standard edition. Upon original research I thought I could use TDE but did not realize that it was only available for Enterprise or DataCenter versions of SQL Servers. Upon further research into SQL Server 2008 R2 features I saw that it does allow for "Data encryption and key management" but I'm not sure what it means or how to implement it.

What is the most efficient and low cost method for data encryption? Should I do something through SQL Server or just use third party tools to encrypt the whole volume where DB and backups are? Also if someone can point to a way to use "Data encryption" that comes as feature in standard edition I would really appreciate. Every time I search for encryption on sql server I keep ending up on how to use TDE and in current scenario it is not feasible for the size of business to purchase Enterprise Edition.

Increase all primary key values by 1

Posted: 23 Sep 2013 07:02 PM PDT

How do I increase all of my EmployeeID values by one if it is the primary key?

Why is MySQL database data-files deployed under /var/lib/mysql?

Posted: 23 Sep 2013 08:43 AM PDT

I was wondering why do we deploy data files under /var/lib/mysql/. Is there a logical reason for that, or is that just a "traditional" place for the data?

I will value more answers based on standards like the LSB or the POSIX, and would appreciate links to the policies of your favourite Linux or Unix implementation that dictate this is the expected place to deploy your data.

Many thanks in advance for your attention and answers.

Kind regards,

-- LMC

Restoring Master database SQL Server 2005 [duplicate]

Posted: 23 Sep 2013 09:42 AM PDT

This question is an exact duplicate of:

Because of sudden power-cut my server has gone down and the master database was corrupted, so I had an old version of (master.mdf) which I copied and pasted to folder C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data which at least let me start Management tools now I had few custom databases which are either in suspected mode or In recovery mode.

I think the reason is because master database I pasted it outdated, how can I recover my other databases ? Please help.

Converting .TPS (TopSpeed) to SQL

Posted: 23 Sep 2013 08:47 AM PDT

I have an older application that uses TopSpeed as the database engine. I want to use some of the data contained in these tables in another application that uses SQL. To accomplish this, I purchased the TPS ODBC driver and used Access to move the data from the TPS tables to an SQL database by using the linked tables feature.

This works fine, but I'm looking for an automated solution (plus, the Access way is messy). Is there a tool out there that could help?

MySQL SSL encryption

Posted: 23 Sep 2013 03:22 PM PDT

Does setting MASTER_SSL to 1 in change master ensure encryption without specifying options MASTER_SSL_CA, MASTER_SSL_CAPATH, MASTER_SSL_CERT, MASTER_SSL_KEY ?

After setting MASTER_SSL to 1, show slave status says Master_SSL_Allowed: yes, but does that ensure the transferred data will be encrypted?

 Master_SSL_Allowed: Yes   Master_SSL_CA_File:   Master_SSL_CA_Path:      Master_SSL_Cert:    Master_SSL_Cipher:       Master_SSL_Key:  

Thanks!

MySQL asynchronous multi master replication conflict resolution

Posted: 23 Sep 2013 05:24 PM PDT

I have setup Multi Master replication, following this blog thread:

http://0wned.it/geek-bits/guides/mysql-multi-master-replication/

And now it synchronizes perfectly, up until the moment the connection between the servers is lost. When I have no connection both servers still update fields. This results in the following problem:

  • connection is lost.
  • server1 updates a field to the value "bike".
  • server2 updates the same field a few seconds later to the value "car"
  • connection restored
  • server1 gets the value "car" from server2 and updates the field
  • server2 gets the value "bike" from server 1 and updates the field.

Is there a way to check if the value has already has been changed and neglect the update based on time of update? In the field on both servers the value "car" should be the current value.

How to repair Microsoft.SqlServer.Types assembly

Posted: 23 Sep 2013 06:22 PM PDT

When I run a checkdb('mydb') this is the only error message printed.

Msg 8992, Level 16, State 1, Line 1  Check Catalog Msg 3857, State 1: The attribute (clr_name=NULL) is required but is missing for row (assembly_id=1) in sys.assemblies.  

It is referring to 'Microsoft.SqlServer.Types' I do see that in the this db the clr_name is blank. but under the master db there is a value in there.

I tried to drop or alter the assembly to add this value but its restricted.

btw, this db was updated lately from sql-server 2005 to 2008R2.

Efficient way to perform approximated search?

Posted: 23 Sep 2013 11:22 AM PDT

I have to perform a join between table_a and table_b, using three fields as key being one of them the date of the event, say, both tables have id1, id2 and evnt_time for eache record.

As it happens though, the evnt_time can be displaced in a few seconds between these tables. Thus the join has to behave sort of table_a.id1 = table_b.id1 and table_a.id2 = table_b.id2 and table_a.evnt_time ~ table_b.evnt_time, where:

  • ~ means approximately, given + or - seconds
  • There must be a way to give ~ parameters of how precise should be. e.g.: table_a.evnt_time ~(2) table_b.evnt_time will join table_a.evnt_time with table_b.evnt_time - 2s, table_b.evnt_time - 1s, table_b.evnt_time, table_b.evnt_time + 1s and table_b.evnt_time + 2s.

To tackle the situation, there are a few possibilities I am experimenting, but my doubt is on which architecture should I use to perform a very efficient "approximated join" - these tables are partitioned, sub-partitioned and each sub part may contain billions of records... (although I have a reasonable amount of resources).

For once, I thought of storing the unique sencond of the event (i.e. second it happened since julian calendar) on both sides so the real join (give a "~(2)") could simply look like:

select *  from      table_a,      table_b  where      table_a.id1 = table_b.id1      and table_a.id2 = table_b.id2      and (table_a.evnt_sec = table_b.evnt_sec           or table_a.evnt_sec = table_b.evnt_sec + 1          or table_a.evnt_sec = table_b.evnt_sec + 2          or table_a.evnt_sec = table_b.evnt_sec - 1          or table_a.evnt_sec = table_b.evnt_sec - 2)  

But I am unsure of how efficiently would that perform with the indexes and scans..

This is just an example, I am not stuck to any sort of architecture. Also, I am using Oracle 11gR2.

MySQL: Error reading communication packets

Posted: 23 Sep 2013 07:22 AM PDT

I get this warning in mysql,

[Warning] Aborted connection 21 to db: 'MyDB' user: 'MyUser' host: 'localhost' (Got an error reading communication packets)  

I have been through few topics in google and according to some suggestion I increased the max_allowed_packet from 128 to 512 to 1024 still the same behaviour.

I am using Drupal 7, and yes there are lots of blob data types, but 1024 Mb of max_allowed_packet should be enough in my opinion.

Any other workaround how to overcome this warning ?

EDIT:

Added some settings as @Rolando's suggestions/answer, I still get the same warning.

My mysql config looks like this:

[client]  port        = 3306  socket      = /tmp/mysql.sock  default-character-set = utf8    [mysqld]  port        = 3306  socket      = /tmp/mysql.sock  skip-external-locking  key_buffer_size = 16K   max_allowed_packet = 1024M   table_open_cache = 128   sort_buffer_size = 64K  read_buffer_size = 256K  read_rnd_buffer_size = 256K  net_buffer_length = 2K  thread_stack = 192K  # Query cache disabled  thread_cache_size = 8  myisam-recover = BACKUP  max_connections = 100  thread_concurrency = 10  tmp_table_size = 128M  max_heap_table_size = 128M  log_error                = /var/log/mysql/mysql-error.log  log_slow_queries        = /var/log/mysql/mysql-slow.log  long_query_time = 2    log_warnings = 2    server-id   = 1  binlog-format = row  replicate-same-server-id = 0  auto-increment-increment = 2  auto-increment-offset = 1  log_bin = mysql-bin  log-slave-updates  relay-log=mysqld-relay-bin  expire_logs_days        = 10  max_binlog_size         = 100M    innodb_data_home_dir = /var/db/mysql  innodb_data_file_path = ibdata1:10M:autoextend  innodb_log_group_home_dir = /var/db/mysql  innodb_buffer_pool_size = 8G  character-set-server = utf8  #innodb_additional_mem_pool_size = 2M  innodb_log_file_size = 2047M  innodb_log_buffer_size = 32M  innodb_flush_log_at_trx_commit = 2  innodb_thread_concurrency = 8  innodb_lock_wait_timeout = 50  innodb_flush_method = O_DIRECT    [mysqldump]  quick  quote-names  max_allowed_packet = 16M  default-character-set = utf8    [mysql]  default-character-set = utf8    [myisamchk]  key_buffer_size = 32M  sort_buffer_size = 32M    [mysqlhotcopy]  interactive-timeout    [mysqld_save]  syslog  

My application uses only InnoDB, but there are few database like mysql, which came with the standard mysql installations are only the ones which uses MyISAM engine type, I guess that should not be my concern though.

As you can see I have replication too, the warning is the same one in replicated server too, whose config is identical as this.

Inserting query result to another table hangs on "Copying to temp table on disk" on MySQL

Posted: 23 Sep 2013 04:22 PM PDT

I started the process of inserting returned results to another table. The query groups the rows in respect of indexed IDs. This causes 149,000,000 rows to be decreased to 460,000 rows.

The query includes 3 table INNER JOINs, with each table having about 20,000,000 rows.

Further information, the process completes in about 12 seconds for a test file which has 1000 input rows, and returns 703 rows.

I started the query earlier ### we don't know when earlier is ###, but it is still running in the state: "Copying to temp table on disk" after 38000 seconds (10 and a half hours).

I think there is a problem during the insertion process. What am I probably doing wrong here? If it helps, the operating system of the computer is Windows 7, it has 3 GB RAM, an Intel Core2Duo 2.27GHz processor. ### you forgot to tell us details on the hard drive. One partition in, one out, same disk, same partitions, etc ###

Here's my query as it currently reads:

INSERT INTO kdd.contents               (adid,                descriptionwords,                purchasedkeywordwords,                titlewords)   SELECT t.adid,          dt.tokensid,          pkt.tokensid,          tt.tokensid   FROM   kdd.training t         INNER JOIN kdd.purchasedkeywordid_tokensid pkt                 ON t.keywordid = pkt.purchasedkeywordid          INNER JOIN kdd.titleid_tokensid tt                 ON t.titleid = tt.titleid          INNER JOIN kdd.descriptionid_tokensid dt                 ON t.descriptionid = dt.descriptionid   GROUP  BY adid;   

Primary key type change not reflected in foreign keys with MySQL Workbench

Posted: 23 Sep 2013 05:22 PM PDT

I have a problem with MySQL Workbench and primary/foreign keys.

I have some tables with PKs involved in relationship with other tables. If I modify the type of the PK, the type of the FK doesn't automatically update to reflect the change.

Is there any solution? Do I have to manually modify all the relations?

Can't connect to MySQL database over SSH with Workbench

Posted: 23 Sep 2013 08:17 AM PDT

I'm trying to connect to my database via SSH tunneling from one of our web app servers with MySQL Workbench. Here's the basic config; note that I changed some values in the screenshot for security reasons.

Workbench screenshot

The problem is every time I try to connect over an SSH tunnel from one of our app servers, I get the following error:

Failed to connect to us-east-1.amazonaws.com through SSH tunnel at computer.amazonaws.com with user social_shop_prod. Can't connect to MySQL server on 127.0.0.1.

However, if I use the same credentials over SSH via the following command line:

mysql -u social_shop_prod -h us-east-1.amazonaws.com -p  

I can connect successfully and get the MySQL interactive command prompt.

Been talking with the rest of my development team here and none of us can figure out why I can't tunnel over SSH from our app servers with Workbench; but when I SSH to one of our app servers and connect to MySQL via the command line; I can connect successfully.

And why is it trying to connect over 127.0.0.1? I didn't specify that in the configuration; nor is my hosts file redirecting the domains shown below to that IP.

Any constructive input is greatly appreciated.

Is encrypted database possible?

Posted: 23 Sep 2013 11:04 AM PDT

I'm not a DBA but I've been asked to see if we can encrypt the data in sql server such that the admin, despite having access to SQL Server won't be able to see the data but application would still be able to query on it and read the data.

My limited knowledge of encryption tells me that if application encrypts the data then db won't be able to query it. If db encrypts the data then DBA can definitely read it.

So is there a way to prevent DBA from peeking into data but still be able to manage database?

Oracle SQL - CASE in a WHERE clause

Posted: 23 Sep 2013 12:18 PM PDT

Is it possible to somehow do this?

WITH T1 AS  (     SELECT 1 AS SEQ, 'NOTHING 1' AS SOME_TYPE FROM DUAL UNION ALL     SELECT 2 AS SEQ, 'NOTHING 2' AS SOME_TYPE FROM DUAL UNION ALL     SELECT 3 AS SEQ, 'SOMETHING 1' AS SOME_TYPE FROM DUAL UNION ALL     SELECT 4 AS SEQ, 'SOMETHING 2' AS SOME_TYPE FROM DUAL UNION ALL     SELECT 5 AS SEQ, 'SOMETHING 3' AS SOME_TYPE FROM DUAL UNION ALL     select 6 as seq, 'SOMETHING 4' AS SOME_TYPE from dual  )  , T2 AS  (     SELECT 'A' AS COMPARE_TYPE FROM DUAL UNION ALL     SELECT 'B' AS COMPARE_TYPE FROM DUAL   )  SELECT T2.*, T1.*   FROM T1, T2  WHERE  CASE T2.COMPARE_TYPE            WHEN 'A'              THEN T1.SOME_TYPE LIKE 'NOTHING%'           ELSE T1.SOME_TYPE NOT LIKE 'NOTHING%'         END  

I know that my WHERE is clause is not correct.

Any help would be great in knowing if this type of statement is possible.

I don't want to write a Dynamic SQL. If I have to I will write 2 different SQL statements.

Thanks

Software Engineers and DBAs

Posted: 23 Sep 2013 12:09 PM PDT

What are main differences between Database Administrators and Software Engineers? To what extent should a Software Engineer know the details of the underlying database? Where is the border between these two professions?

No comments:

Post a Comment

Search This Blog