PHPMyAdmin issue: Is it advisable to assign a very large value to `$cfg['MaxExactCount']`? - mysql

I have a MySQL table with exactly 1 million rows of dummy data for testing purposes. However when I click the table's "browse" option, this is what I get:
Notice how it says there are only 994,622 records whereas I know there are more.
Funny thing is I can still retrieve those invisible records if I perform a search. For instance, the PHONE field is filled with numbers incrementing from 00000000 through 01000000; thus, the row containing the value 00999999 should exist. And it does:
However, as per the "Browse" screen, the last row in view is the one with the value "00994625." Here's a screenshot that shows the last record; do note the absence of any "next" arrow/link:
I haven't tried exporting so not sure if all records will export. I managed to fix this problem by adding $cfg['MaxExactCount'] to my config.inc.php file. However, I am concerned if this is advisable. I am anticipating my table to grow indefinitely once live and could eventually wind up with several millions of rows. Would it be alright if I just assigned a very large value, say 10000000000, to $cfg['MaxExactCount']? What are the pitfalls and how to avoid them? Also, do shared hosting providers generally allow one the access to alter this particular file?

Yes, you've correctly diagnosed the problem, at least it seems that way. As you've probably seen in the documentation, the MaxExactCount directive is basically used to configure at what point phpMyAdmin uses a faster but inexact row count.
Whether it's a good idea to change it is pretty much up to you. The problem would be performance based and depends on your situation (table structure, server specs and load, etc) but it's worth trying to see what happens.
If you're able to modify config.inc.php then go for it; some hosts provide phpMyAdmin by putting a copy of the phpMyAdmin folder in your web root (in which case you'll be able to modify config.inc.php directly), others use one centrally located copy and configure the web server to make it appear under your domain (in which case you probably won't even be able to find the phpMyAdmin folder, much less modify it). If they don't give you access, you can easily install your own phpMyAdmin instance to your own web root, giving the folder a different name from what your provider uses so as to not conflict, and make whatever modifications you want.

Related

Search and Replace in PHPMyAdmin database for Wordpress (absolute beginner)

I apologise in advance for I know that this question has been asked several times already, but being a complete beginner at wordpress coding and database handling, I am still not sure about what those answers really meant.
So having just coded a website and converted it into WordPress, I now find myself having to change all of the localhost strings to the accurate ones, but with hundreds to go through, I just wanted to know if any of you were able to recommend a program or technique within PHPMyAdmin (that I may not be aware of) to avoid having to change them one at a time.
Thank you all in advance for your time and attention.
First, let me start by saying this is very dangerous, especially for an absolute beginner such as yourself. Please use this with extreme caution as you can potentially bring the entire site down by replacing values in your database with the wrong data.
With that said, there is a script specifically designed for doing search and replace on the WordPress MySQL database. http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Here's the direct download link: https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
You will extract the folder from the donwloaded zip, then upload the folder to the root of your WordPress install. Once its uploaded just reference the folder in the browser. I always rename the folder to sr (shorthand for search and replace) so its easier to write out the full URL. So as an example, once its in the root of the WordPress install you'd access it like www.example.com/sr/.
After you access the script in the browser, you'll have a GUI with two boxes at the top. The first you'll enter the string you're searching for, and the replace string goes in the second box. Your MySQL details/login should already be populated. After entering your S&R terms scroll down and click "Update Details", then do the "Dry Run" option first. It'll run through the database and show you the values that will be changed. If you are satisfied with the changes, click "Live Run".
Depending on the database size it'll take just a short time to complete. This is the easiest way to S&R the WordPress database.
Important: for security reasons you'll want to delete this folder from your server after you have finished using it. You don't want a database S&R utility just lingering around for no reason.
Another possible option if you're familiar with WP-CLI is to use the wp search-replace command: https://developer.wordpress.org/cli/commands/search-replace/ This would be done through Terminal or another command line utility.
In phpMyAdmin open your table, choose Search > Find and replace. Then specify in which column you want to find and replace, and the original and replacement texts.
Without any doubt I would use http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
This tool is especially designed for the situation you describe.
You upload the code to your server and then enter the "find" and "replace"
You can then do a dry run and the system will show you all the replaces that will be made across every single table in your Wordpress database.
Once you're happy then you can do a live run and the changes are made.
I have used this on probably one hundred Wordpress sites and it works a charm.

If ENUM allows for only certain data to be entered can it influence a second column?

Using phpMyAdmin 5.6 to build a database installed using WAMP.
With ENUM you limit the possible entry into a field.
I have 2 columns that I want to interact with each other.
In column 1 you pick a state in column 2 you are presented with a list of counties only in the state you picked in column 1.
Can this even be done?
Or does this have to be done on the website development side?
I'm pretty sure this is not possible to do through phpMyAdmin, and additionally I don't really see the point. Since you shouldn't be presenting phpMyAdmin to your users anyway, you should do this at the application layer when you're building the dialog for the user. Doing it only in phpMyAdmin doesn't seem to make much sense to me, and is not really using it for the intended purpose (which is database maintenance and administrative work, not end-user input). I'm

Where are the MS Access tables I have shortcuts to?

I have a MS Access 2013 file that I am using. There are two possibly related concerns. For some context, this is an MS Access 2013 file with some forms and some tables and a bit of VBA for the logic of how those two interact. For versioning, the file has been copied and pasted with a datestamp on it for the newer version.
The first concern is that all the file sizes for the various files is exactly the same, even though data has been added and some changes to the forms were made.
The second concern is that when I right click on a table and go to table properties, it says "Shortcut to Table (Local): table_name" where table_name is the name of the table. It appears that this is a shortcut to a table somewhere, but I'm not sure where. The forms are also shortcuts to forms, but I don't see the destination form in my file anywhere, even after unhiding system objects. My questions regarding this are: how did this happen (I was assuming it had something to do with the fact that I copied and pasted the file) and where is the file that these are a shortcut to?
Everything seems to work fine, but I'm concerned that if one of the legacy files gets removed that I might lose some data. Is my data being stored within this file, or did it get split somehow and the data is being stored in a different file somewhere? I just want to have a better grasp of what exactly is going on.
I feel like I have a good handle on the SQL and a pretty good grasp of the VBA, but the MS Access specific nuances are something I'm still gaining familiarity with.
Well, it seems it was as simple as changing the view in your navigation pane to something else than custom!

SELECT query is pulling data, source table appears in MSysObjects, Hidden/System are both enabled, but table isn't listed in object browser

I am completely perplexed.
A colleague's got a database issue. I noticed that the (internal) software that created the local database file with the problem, uses programmatic access to MS JET, which meant an easy first step was to see if MS Access (2010) was happy with the database - and then fix, export/import or repair, as a first step.
I copied the stand-alone local Jet data file to a non-networked virtual machine (so no chance of external data), and MS Access opened the db file easily, but I can't make sense of what I'm seeing.
MS Access is configured on that system to show all hidden and system objects, confirmed since the Access system tables in the file are all visible and can be opened. These are my observations:
The object browser lists the usual MS system tables, and a bunch of SELECT queries (which look correct) of the form SELECT (FIELD LIST) FROM (OTHERTABLENAME) WHERE (FIELDNAME=VALUE), nothing more.
The select queries show the usual grid with valid data records when opened, and the data looks correct as well.
No data tables with the given names are showing in the object browser interface.
The given names are listed as objects of the database, in the system table MSysObjects.
So..... the underlying data tables ARE named in MSysObjects, and seem to be true data tables... but they are NOT being listed in the object browser and I can't figure how to open their datasheets (although MS Access' system tables are, and "Show hidden/system" are both enabled)... and the tables surely do exist in the file since an apparent SELECT query is pulling their data from them, and the file is on a clean non-networked machine with no other sources reachable.
Any ideas? I want to check the underlying data but ... whats going on?
When I examined your database, I discovered the reason you can't access the tables normally is because the authors of the internal application which created the db file implemented measures to prevent normal access.
I advise you to contact them and your managers to get authorization and assistance to view the data.
Also, please be cautious with this question. A suspicious person might uncharitably interpret your question as a disguised request for hacking help. Please note I am not accusing you of anything underhanded ... simply asking you to notice how your question might be perceived. And, if that were to happen, I don't know what the consequences would be on Stack Overflow, but I can't imagine it would be good. So please be careful.

Renaming fields in linked-table MDB file pair?

I have an Access 2003 database using MS-JET linked tables (that is, there are two *.mdb files). The overall task is to move to SQL server. However the existing databases have multiple fields with spaces and other characters that upset both of the Access migration wizards. So the intermediate task is to make a version of the existing mdb's with updated field names.
"Simply" changing field names in the UI mdb file doesn't work, because of the linked tables being read-only in that mdb. Updating the Data mdb file field names first doesn't work because the UI mdb then throws a wobbly on startup and Access gives up.
I'm looking for suggestions, but options I can see are:
re-integrate the Data mdb back into the UI one, do the updates, then re-export the data. Seems very risky to me (system is live, don't want to play with data any more than strictly necessary).
I've looked at several answers here relating to changing ODBC details with VBA code, which is interesting, and I can see how I might be able to programmatically edit the linked tables' names. Is this going to work? Is there a better way?
Unlink all linked tables, then edit in UI mdb the remaining forms, reports, queries (but would that work??) and edit the Data mdb fields, and finally relink everything. Will it fall apart?? ... seems likely.
Any suggestions?
Ruth
I go through this process every time I take over an existing Access application -- I have to bring it up to my own standards for naming conventions before I do anything significant with it. Recently I built a quick-and-dirty utility to rename fields. It was made for me and has very little error recovery, and a UI that is ugly, but it might be faster than doing it yourself.
See what track name autocorrect offers. How Name AutoCorrect Works in Microsoft Access
Make a copy of your UI MDB, delete the linked tables, then import them (as tables rather than links) from the Data MDB. Once you enable autocorrect, Access will attempt to propagate your field name changes wherever they are used (in forms for example). Unlikely it will catch 100% of the necessary changes, but it should resolve a big chunk of them. You would then need to manually track down and fix the rest.
Once you have everything fixed, you could use that MDB version to "upsize" your tables to SQL Server. However, one huge complication is if the original database is "live" while you're making changes to the new version. If you absolutely can't take the database out of service in the interim, you could discard the data from the new tables, then use "append" queries which alias the old to new field names to pull in the latest data.
INSERT INTO NewTable (emp_id, another_field)
SELECT
[emp ID],
[another field]
FROM OldTable IN 'C:\somefolder\Data.mdb';
Finally, a warning about autocorrect: do not leave it enabled in the production version of your database because strange things can happen. The safest approach IMO is to turn it on, complete your object name changes, then turn it back off again.
You might find Rick Fisher's Find and Replace tool helpful if you need to propagate name changes through the project. I've relied on it for years (though I don't do much Access development lately): http://www.rickworld.com/products.html
I think this tool will change the names of tables and fields for you but I am not sure. I mostly used it for finding references to tables and queries in other queries, form and report properties, and VBA code.