sagnik Posted December 7, 2017 Posted December 7, 2017 Please increase the Maximum column size of Indexes. i'm having problems on importing database in pma. And as well as if you can increase the 'max_user_connection' that will be great help as I'm also getting this error frequently.
Krydos Posted December 7, 2017 Posted December 7, 2017 When I hit that same limit I found a creative way to create a hash of the index column instead of the index column itself. It works much better than reducing the server performance by changing default settings. Check out something like http://mechanics.flite.com/blog/2015/06/09/hash-based-workarounds-for-mysql-unique-constraint-limitations/ As far as the max_user_connections, are you using persistent connections?
sagnik Posted December 7, 2017 Author Posted December 7, 2017 What do you mean by "Persistent Connections"?
Krydos Posted December 7, 2017 Posted December 7, 2017 Persistent connections https://dev.mysql.com/doc/apis-php/en/apis-php-mysqlnd.persist.html are mysql connections that you don't close. The advantage is that you don't have the overhead of creating and destroying connections. The downside is you use up one of your limited mysql connections and others who share your server suffer from degraded performance due to you hogging resources. As such we highly recommend closing your mysql connections.
sagnik Posted December 8, 2017 Author Posted December 8, 2017 But I need at least 2 connections open until the script reaches it's end. And in addition, if needed I need to open another database in the members section.
sagnik Posted December 8, 2017 Author Posted December 8, 2017 I've not noticed. But in localhost maybe approximately 0.51 seconds the script takes to load.
Krydos Posted December 8, 2017 Posted December 8, 2017 That's pretty long in the world of scripts. If you're opening 3 mysql connections and not closing them for the full half second that means you can only have 2 users during the same half second window.
sagnik Posted December 12, 2017 Author Posted December 12, 2017 Sir can you examine my codes and tell me where I can close the connection?
Krydos Posted December 12, 2017 Posted December 12, 2017 Do something like this$conn = new mysqli("localhost", "user", "password123", "db"); $sql = "select things from stuff where id = '1'"; $result = $conn->query($sql); $row = $result->fetch_assoc(); $thread = $conn->thread_id; $conn->kill($thread); $conn->close(); Open then execute the query then close it immediately. No other code in between. Obviously don't do things like execute mysql queries inside loops, etc. Just write good code basically.
sagnik Posted December 12, 2017 Author Posted December 12, 2017 But sir, I've 2 classes included in common in all pages, one is "WNInternal.php" (This takes care of the things related to Internal functions/features. For example "redirect users based on 'refid'", "get page url from database for mobile/desktop pages") and another is "Whatsnew.php" (It takes care of all the things related to Products/Categories). So how can I close the MySQL connection in between the script. But I've tried to close the connection using my own database function "db_close()" in "__destroy" function but it doesn't work, in fact, it triggers an E_WARNING level error saying that "mysqli_thread_id() - expects parameter 1 to be MySQLi resource", "mysqli_close() - expects parameter 1 to be MySQLi resource", "mysqli_kill() - expects parameter 1 to be MySQLi resource". I hope you can solve the problem. Sir you have root access, so you can check my custom database functions in "/home/sgn/public_html/wn/config/SGSSPL.php". If it needs any changes you can tell me.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now