• 0

Should I create a unique MySQL user per logged in person?


Question

Yo Neowin!

I want to know what do you suggest in terms of security, and speed, whether is recommended or not to create an individual user for each person that logs in to my site.

I mean. I usually verify a username on a table, and assign unique tables to each of my users with a General MySQL user account with limited privileges. But since I've been reading a little bit more about MySQL (I only know the basics), I've seen that to improve security I could assign certain limits on MySQL users and only allow access to certain tables.

So, what can you suggest me in terms of MySQL users?

Thanks :p

14 answers to this question

Recommended Posts

  • 0

What do you mean unique mysql user per logged in user, what type of site is this?

I mean, to create a MySQL user. The default user on a MySQL server is root. I would like to know if it would improve security having a separate user like "John" which would only access Joh_products and John_clients table and will have limited privileges like SELECT, DROP, UPDATE, INSERT commands.

This site, is on development right now, so everything can be modified. It's a receipt management website, which each of the users will have their own clients stats, number of purchases, receipts, etc.

  • 0

I mean, to create a MySQL user. The default user on a MySQL server is root. I would like to know if it would improve security having a separate user like "John" which would only access Joh_products and John_clients table and will have limited privileges like SELECT, DROP, UPDATE, INSERT commands.

This site, is on development right now, so everything can be modified. It's a receipt management website, which each of the users will have their own clients stats, number of purchases, receipts, etc.

I truly would not recommend that at all.

  • 0

NEVER use the root account AT ALL once you've configured the MySQL server, make another account and grant it root-like permissions and ONLY use the root account as a last resort if something breaks to restore everything.

Yes use different accounts for different sites, one account for all clients on one site should be fine i.e. one account for this receipt tracking site, another account for a control panel site, etc.

  • 0

You should only really need one master user for the mysql database itself. Then use web based forms (in PHP for example) to allow the people to add/delete/update their data. They don't need to have direct access to the database tables to do this. I don't really see the point of having totally distinct tables for each user either. Seems like a lot of duplication and you'll end up with a massive amount of tables.

  • 0

Thanks to all of the above. Now I have a clear mind.

NEVER use the root account AT ALL once you've configured the MySQL server, make another account and grant it root-like permissions and ONLY use the root account as a last resort if something breaks to restore everything.

Yes use different accounts for different sites, one account for all clients on one site should be fine i.e. one account for this receipt tracking site, another account for a control panel site, etc.

I shall take this recommendation then :)

I don't really see the point of having totally distinct tables for each user either. Seems like a lot of duplication and you'll end up with a massive amount of tables.

:/ There was no other way my logic could function.

I Googled a bit and found that there wasn't any problem having multiple tables. The thing is that it allows flexibility. I didn't see a good way on putting the client info, the receipt #, the quantity, price of the product purchased (because it has a variable price), the current product id, the tax, and whether it was paid, delivered or not. So I could fetch it in a productive way later on....

Anyways, I'm open to suggestions :D

  • 0

I Googled a bit and found that there wasn't any problem having multiple tables. The thing is that it allows flexibility. I didn't see a good way on putting the client info, the receipt #, the quantity, price of the product purchased (because it has a variable price), the current product id, the tax, and whether it was paid, delivered or not. So I could fetch it in a productive way later on....

Multiple tables are fine, in fact you should be using multiple tables, but there's a much better and organized way of using them. You should be using different tables for storing types of data. If I have Users, Customers, and Receipts; I would create a separate table for each one of them. Then I would create two additional tables used for associations, one for Users->Receipts, and one for Customers->Receipts. These associative tables would only store the unique id's for the rows in the other tables.

Not sure if I explained clear enough or not, also not sure if it's quite the same idea as your system. Either way its best to have different table's for different types of data, since there's no sense in storing the same data multiple times.

  • 0

Certainly use multiple tables, but not for each user. Say you have 10 users and each user has a separate table, if you want to see all the data from all the users you have to search through 10 tables, vs. just the main table for the type of data you want.

So instead of userA_orders, userB_orders, etc. you just have a single orders table, and store what user created the order in the record you insert into the table.

  • 0

if i've read this right. you should create a function user. one user that can insert, update, or delete records, but not modify the database structure. use that user for any transaction, and the root as a last resort.

  • 0

Multiple tables are fine, in fact you should be using multiple tables, but there's a much better and organized way of using them. You should be using different tables for storing types of data. If I have Users, Customers, and Receipts; I would create a separate table for each one of them. Then I would create two additional tables used for associations, one for Users->Receipts, and one for Customers->Receipts. These associative tables would only store the unique id's for the rows in the other tables.

Not sure if I explained clear enough or not, also not sure if it's quite the same idea as your system. Either way its best to have different table's for different types of data, since there's no sense in storing the same data multiple times.

Certainly use multiple tables, but not for each user. Say you have 10 users and each user has a separate table, if you want to see all the data from all the users you have to search through 10 tables, vs. just the main table for the type of data you want.

So instead of userA_orders, userB_orders, etc. you just have a single orders table, and store what user created the order in the record you insert into the table.

Now I get it! Yup. Indeed. I know my logic was failing somewhere.

I just need to create a separate column with the current logged in user, and bang it with a WHERE clause to identify the user (*poker face*)

Aaaargh.

Going to work on it right now

Thank you people :D

This topic is now closed to further replies.
  • Posts

    • Microsoft Weekly: 5 years of Windows 11, more support for Windows 10, and expensive Xbox by Taras Buria This week's news recap is here, with Microsoft giving Windows 10 one more year of support, Windows 11 getting new taskbar settings in preview updates, Steam Machine prices, higher XBOX prices, and many more. Quick links: Windows 10 and 11 Windows Insider Program Updates are available Reviews are in Gaming news Great deals to check Windows 11 and Windows 10 Here, we talk about everything happening around Microsoft's latest operating system in the Stable channel and preview builds: new features, removed features, controversies, bugs, interesting findings, and more. And, of course, you may find a word or two about older versions. On June 24, 2026, Windows 11 turned five. The controversial operating system was released half a decade ago, and during these years, it received a fair share of criticism (such as poor Windows Search and its web results), which Microsoft is now actively addressing with regular preview updates that deliver missing, long-requested features. With Windows 12 nowhere to be seen on the horizon, it will be interesting to see if Windows 11 can stay on the market for as long as Windows 10 did. Speaking of Windows 10 and staying on the market, this week, Microsoft quietly prolonged the Extended Security Updates program for Windows 10, allowing users to get one more year of security updates if they do not want or cannot upgrade to Windows 11. Finally, Microsoft released this month's non-security update for Windows 11. KB5095093 arrived with a traditionally long list of new features, including point-in-time restore, new Windows Update settings, quieter Windows Widgets, new accessibility features, File Explorer updates and performance improvements, and more. Windows Insider Program Here is what Microsoft released for Windows Insiders this week: Builds Canary Channel Build 29617.1000 and build 28120.2374 These builds bring new accessibility features, new Windows Update controls, audio improvements, and more. Dev Channel Build 26300.8758 This build includes redesigned taskbar settings, File Explorer improvements, and more. Beta Channel Build 26220.8754 and build 28020.2366 This small update fixes the OneDrive bug in File Explorer, tweaks system sounds in dark mode, and more. Updates are available This section covers software, firmware, and other notable updates (released and coming soon) delivering new features, security fixes, improvements, patches, and more from Microsoft and third parties. If you use AI-powered browsing history search in Microsoft Edge, the company has bad news. A new update on the Microsoft 365 Roadmap revealed that Microsoft is discontinuing the feature. Despite using on-device models for natural search, some users found it creepy, claiming that Microsoft lacks trust in features like this. While the ability to find pages without using 100% precise words may sound cool, customers argued that it was nothing but another feature to bloat the browser with more AI. Good riddance? PowerToys received several updates this week. For one, Microsoft released version 0.100.1 with several improvements and bug fixes for the recently arrived version 0.100. A couple of days later, Microsoft dropped another update, this time fixing memory leaks in Command Palette Dock. In addition, the company is working on a new module that will make it easier to switch between windows within one application using the Alt + ` shortcut. The new module should make it to the stable release somewhere soon. Here are other updates and releases you may find interesting: New Ventoy update adds Windows 11's mandatory update support and more Microsoft updates Visual Studio Code with chat cost tracking and multi-agent chats Microsoft is building an AI datacenter that "uses less water than a fast food restaurant" Microsoft adds new AI study and teaching tools for free to Microsoft 365 Education Researchers claim Microsoft's quantum breakthrough is flawed by basic Python errors Microsoft is bringing a much-needed Recap app to Teams Microsoft's fast coding model, MAI-Code-1-Flash, comes to Copilot Business and Enterprise Here are the latest drivers and firmware updates released this week: AMD Radeon Software 26.6.2 with FSR 4.1 support for RDNA 3 graphics card. However, the driver contained a bug, which prevented installations on Windows 10 PCs. AMD fixed that with a quick hotfix update. Reviews are in Here is the hardware and software we reviewed this week This week, Steven Parker published several reviews. He shared his experience with the Creative Sound Blaster AE-X PCIe, a high-quality sound card with a headphone amp, low-latency communications, great build quality, and DSD256. However, it is on the pricier side of the spectrum, and it lacks EMI shielding. Check out the full review here. The second review is about the TerraMaster F4-425 Pro, an octa-core Intel NAS with a stand-out feature: built-in AI (OpenClaw). We also published a few Hands On reviews, which you can view below: We check out the SKG PS700 Neck Massager SKG Hand Massager with Heat OS500 hands on Hands-on with BOOX Tappy: cute little reading accessory Hands on with the ProtoArc EM25 affordable ergonomic mouse On the gaming side Learn about upcoming game releases, Xbox rumors, new hardware, software updates, freebies, deals, discounts, and more. If you plan to purchase a new Xbox, it's time to act now. This week, Microsoft announced yet another Xbox price increase. Starting August 1, 2026, all Xbox Series X|S models with 512 GB of storage will cost $100 more. As for the 1TB models, they are going up in price by a whopping $150. Finally, Microsoft is discontinuing the 2TB Xbox Series X. To make up for that, Microsoft announced a few programs to make its consoles more accessible. Those include BNPL, interest-free financing, pre-owned consoles, certified refurbished consoles, and more. Valve also shared some not-so-welcome news. The company has finally announced prices of the upcoming Steam Machine console, and if you plan to buy one, get ready to spend a whopping $1,049 on the 512GB configuration. The Steam Machine is now available for preorder, with shipments scheduled for June 29, 2026. Grand Theft Auto VI also received its official price tag. Rockstar Games announced that the long-anticipated game will launch at $79.99 for the base edition and $99.99 for the ultimate edition. The latter includes an exclusive collection of premium vehicles, weapons, apparel, and action threaded across all aspects of Jason and Lucia’s story." Those who preorder the game will get extra bonuses, including a Vintage Vice City Pack of cosmetic items as well as a free month of GTA+. NVIDIA announced new games for its GeForce NOW streaming service. Those include Dark Scrolls, SAND: Raiders of Sophie, Deer & Boy, EMPULSE, and more. Steam is running its annual Summer Sale, during which you can purchase plenty of various games with big discounts. It runs until July 9, so in case you missed it, you can still get some games at a lower price. Also, you can get two games for free in the Epic Games Store, plus more deals are available in this week's Weekend PC Game Deals issue. This link will take you to other issues of the Microsoft Weekly series. You can also support Neowin by registering for a free member account or subscribing for extra member benefits, along with an ad-free tier option.
    • Text extractor hasn't been working great on 0.99.1 but I am now updating to this version, hopefully it's better!
    • Yet you did exactly what they wanted you to do - is it better now without "Europrats"? BTW, UK had joined EU (EEC back then) and was one of the leading member states, it never joined Schengen Zone though 😉
    • Weekend PC Game Deals: Steam Summer Sale 2026 Edition by Pulasthi Ariyasinghe Weekend PC Game Deals is where the hottest gaming deals from all over the internet are gathered into one place every week for your consumption. So kick back, relax, and hold on to your wallets. The Epic Games Store's freebie offer brought two more games to keep this week too. What you can grab this time are copies of RollerCoaster Tycoon 3 Complete Edition and Voidwrought. Roller Coaster Tycoon 3 is an enhanced version of the classic title that comes with enhancements like widescreen and 1080p resolution support. Its two expansion packs are included here too. Meanwhile, Voidwrought is a 2D action-platformer with tight platforming and high-speed combat against cosmic horrors. The double giveaway is slated to last until July 2. On the same day, I Have No Mouth, and I Must Scream and River City Girls 2 will take the same freebie spot. The Humble Store introduced a couple of new game bundles earlier this week. The Going Rogue collection begins with Rogue Legacy, UnderMine, and None Shall Intrude in the starting tier for $5. If you pay the $10 it's asking to complete the bundle, you also get copies of Brutal Orchestra, Moros Protocol, Nightmare Reaper, Home Behind 2, and Lynked: Banner of the Spark. If it's fighting games you're looking for, the new Arc System Works Evo bundle is carrying plenty. The three tiers of this bundle that go up to $20 carry games like Melty Blood Actress Again Current Code, GUILTY GEAR Xrd REV 2, KILL la KILL - IF, Blazblue Cross Tag Battle, Guilty Gear -STRIVE-, Blazblue CentralFiction, and more. Big Deals One of the biggest sale events of the year, the Steam Summer Sale, has just kicked off, and that means almost every PC game available is now featuring discounts. We have plenty of games for you to look over in our special hand-picked big deals list for the weekend below: Baldur's Gate 3 – $44.99 on Steam Anno 117: Pax Romana – $41.99 on Steam S.T.A.L.K.E.R. 2: Heart of Chornobyl – $41.99 on Steam Indiana Jones and the Great Circle – $41.99 on Steam NINJA GAIDEN 4 – $41.99 on Steam Dying Light: The Beast – $39.59 on Steam Ghost of Tsushima DIRECTOR'S CUT – $35.99 on Steam Battlefield 6 – $34.99 on Steam Cities: Skylines II – $34.99 on Steam The Elder Scrolls IV: Oblivion Remastered – $34.99 on Steam The Outer Worlds 2 – $34.99 on Steam Borderlands 4 – $34.99 on Steam Sid Meier's Civilization VII – $34.99 on Steam Mafia: The Old Country – $34.99 on Steam Split Fiction – $32.49 on Steam Assassin’s Creed Shadows – $31.49 on Steam HELLDIVERS 2 – $29.99 on Steam Diablo IV – $29.99 on Steam ARC Raiders – $29.99 on Steam Forza Horizon 5 – $29.99 on Steam Sekiro: Shadows Die Twice - GOTY Edition – $29.99 on Steam No Rest for the Wicked – $27.99 on Steam Metaphor: ReFantazio – $27.99 on Steam Ready or Not – $24.99 on Steam Kingdom Come: Deliverance II – $23.99 on Steam No Man's Sky – $23.99 on Steam Marvel’s Spider-Man Remastered – $23.99 on Steam DOOM: The Dark Ages – $23.09 on Steam Mewgenics – $22.49 on Steam Persona 3 Reload – $20.99 on Steam Hades II – $20.99 on Steam Two Point Museum – $20.09 on Steam Mount & Blade II: Bannerlord – $19.99 on Steam God of War – $19.99 on Steam Warhammer 40,000: Rogue Trader – $19.99 on Steam Returnal – $19.79 on Steam Warhammer 40,000: Space Marine 2 – $17.99 on Steam Cyberpunk 2077 – $17.99 on Steam Avatar: Frontiers of Pandora – $17.99 on Steam Star Wars Outlaws – $17.49 on Steam REPLACED – $15.99 on Steam Days Gone – $15.99 on Steam Age of Mythology: Retold – $14.99 on Steam Crusader Kings III – $14.99 on Steam Red Dead Redemption 2 – $14.99 on Steam Half-Life: Alyx – $14.99 on Steam Grand Theft Auto V Enhanced – $14.99 on Steam EA SPORTS FC 26 – $13.99 on Steam The Crew Motorfest – $13.99 on Steam Sea of Thieves: 2026 Edition – $13.99 on Steam Age of Empires IV: Anniversary Edition – $13.99 on Steam Dead Cells – $12.49 on Steam Schedule I – $11.99 on Steam BioShock: The Collection – $11.99 on Steam Fable Anniversary – $11.54 on Steam Hearts of Iron IV – $9.99 on Steam Kerbal Space Program – $9.99 on Steam Tom Clancy's Ghost Recon Wildlands – $9.99 on Steam The Riftbreaker – $8.99 on Steam Stardew Valley – $8.99 on Steam Total War: WARHAMMER III – $8.99 on Steam Sons Of The Forest – $8.99 on Steam Assassin's Creed Origins – $8.99 on Steam Risk of Rain 2 – $8.24 on Steam Tom Clancy’s The Division 2 – $7.49 on Steam Call of Duty: Modern Warfare® II – $6.99 on Steam CONTROL Ultimate Edition – $5.99 on Steam Dead Space – $5.99 on Steam The Quarry – $5.99 on Steam RV There Yet? – $5.59 on Steam Euro Truck Simulator 2 – $4.99 on Steam Terraria – $4.99 on Steam PEAK – $4.95 on Steam Detroit: Become Human – $3.99 on Steam Far Cry 3 – $3.99 on Steam A Plague Tale: Innocence – $3.99 on Steam The Witcher 3: Wild Hunt – $3.99 on Steam Assetto Corsa Competizione – $3.99 on Steam PAYDAY 2 – $2.99 on Steam Wreckfest – $2.99 on Steam Rain World – $2.49 on Steam Watch_Dogs 2 – $2.49 on Steam Planet Zoo – $2.24 on Steam Bendy and the Dark Revival – $1.99 on Steam CARRION – $1.99 on Steam The Binding of Isaac: Rebirth – $1.49 on Steam Plague Inc: Evolved – $1.49 on Steam Don't Starve Together – $1.49 on Steam Metro 2033 Redux – $0.99 on Steam Hotline Miami – $0.99 on Steam RollerCoaster Tycoon 3 Complete Edition – $0 on Epic Store Voidwrought – $0 on Epic Store DRM-free Specials The GOG store is in the middle of its own summer sale. Here are some highlights from the DRM-free store: Clair Obscur: Expedition 33 - $39.99 on GOG Hollow Knight: Silksong - $14.99 on GOG Resident Evil Bundle - $12.49 on GOG Tomb Raider I-III Remastered Starring Lara Croft - $11.99 on GOG Alpha Protocol - $9.99 on GOG Vampire: The Masquerade - Bloodlines™ - $9.99 on GOG Fallout: New Vegas Ultimate Edition - $9.99 on GOG Disco Elysium - The Final Cut - $9.99 on GOG Dino Crisis Bundle - $8.49 on GOG Cold Fear - $8.25 on GOG Star Trek: Armada II - $7.49 on GOG Star Trek: Starfleet Command III - $7.49 on GOG Warhammer: Dark Omen - $7.49 on GOG Hollow Knight - $7.49 on GOG Mortal Kombat Trilogy - $6.49 on GOG Soldier of Fortune: Platinum Edition - $6.49 on GOG Heroes of Might and Magic 3: Complete - $4.99 on GOG SWAT 4: Gold Edition - $4.99 on GOG RollerCoaster Tycoon 2: Triple Thrill Pack - $4.99 on GOG Stranglehold - $4.99 on GOG ANSTOSS 3: Der Fußballmanager - $4.79 on GOG Firewatch - $3.99 on GOG Emperor: Rise of the Middle Kingdom - $2.99 on GOG Myst Masterpiece Edition - $2.99 on GOG Settlers 3: Ultimate Collection - $2.49 on GOG World in Conflict: Complete Edition - $2.49 on GOG Keep in mind that availability and pricing for some deals could vary depending on the region. That's it for our pick of this weekend's PC game deals, and hopefully, some of you have enough self-restraint not to keep adding to your ever-growing backlogs. As always, there are an enormous number of other deals ready and waiting all over the interwebs, as well as on services you may already subscribe to if you comb through them, so keep your eyes open for those, and have a great weekend.
    • Yup, that's a doozy right there 😄
  • Recent Achievements

    • Week One Done
      flexorcist earned a badge
      Week One Done
    • One Month Later
      Woland13 earned a badge
      One Month Later
    • Week One Done
      Woland13 earned a badge
      Week One Done
    • One Year In
      bernmeister earned a badge
      One Year In
    • Week One Done
      Scoobystu earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      502
    2. 2
      +Edouard
      226
    3. 3
      PsYcHoKiLLa
      158
    4. 4
      Steven P.
      75
    5. 5
      FloatingFatMan
      71
  • Tell a friend

    Love Neowin? Tell a friend!