Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Friday, August 28, 2026

Steps to MySQL Installation (on Ubuntu) and Connection using DBeaver (2026 Aug)

User: jain@jain-Latitude-5310

#1

$ lsb_release -a

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 25.04
Release:	25.04
Codename:	plucky

#2

$ sudo apt install mysql-server -y

#3

$ mysql --version
mysql  Ver 8.4.7-0ubuntu0.25.04.2 for Linux on x86_64 ((Ubuntu))

$ mysql -V
mysql  Ver 8.4.7-0ubuntu0.25.04.2 for Linux on x86_64 ((Ubuntu))

#4: Start MySQL Service

$ sudo systemctl start mysql

#5: Enable MySQL to start on boot

$ sudo systemctl enable mysql

#6: Verify MySQL is Running

$ sudo systemctl status mysql

● mysql.service - MySQL Community Server
     Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: enabled)
     Active: active (running) since Fri 2026-08-28 08:42:03 IST; 1h 29min ago
 Invocation: 9dc06742a2994e4596ffb7c804f43a5f
   Main PID: 7299 (mysqld)
     Status: "Server is operational"
      Tasks: 37 (limit: 17977)
     Memory: 428.5M (peak: 442.1M)
        CPU: 59.251s
     CGroup: /system.slice/mysql.service
             └─7299 /usr/sbin/mysqld

Aug 28 08:42:02 jain-Latitude-5310 systemd[1]: Starting mysql.service - MySQL Community Server...
Aug 28 08:42:03 jain-Latitude-5310 systemd[1]: Started mysql.service - MySQL Community Server.

#7: Set up "root" password
Note: Below command is using default identification method -- which will cause us trouble when we will try to connect to MySQL using DBeaver

$ sudo mysql -u root

[sudo] password for jain: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.7-0ubuntu0.25.04.2 (Ubuntu)

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)

mysql> ^C
mysql> 
[1]+  Stopped                 sudo mysql -u root

$ sudo mysql -u root -p

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.4.7-0ubuntu0.25.04.2 (Ubuntu)

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

#8: Fixing "Access denied for user root@localhost"

mysql> SELECT user, host, plugin FROM mysql.user WHERE user='root';
+------+-----------+-------------+
| user | host      | plugin      |
+------+-----------+-------------+
| root | localhost | auth_socket |
+------+-----------+-------------+
1 row in set (0.01 sec)

mysql> 

If the plugin is auth_socket, change it to caching_sha2_password or mysql_native_password
(Replace caching_sha2_password with mysql_native_password if your client does not support the new default.)

sql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'root';
sql> FLUSH PRIVILEGES;

Error changes to:
Public Key Retrieval is not allowed.

#9: Fix is to use "mysql_native_password" as authentication method

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
But...

ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded


If you really need mysql_native_password (e.g., for an old client) You can try to load the plugin manually: Check if the plugin is listed (but disabled): sql> SHOW PLUGINS; Look for mysql_native_password in the list. If it’s there but not active, you may need to enable it (** AS DESCRIBED BELOW IN #10 **). If it’s completely missing, load it: sql> INSTALL PLUGIN mysql_native_password SONAME 'mysql_native_password.so'; Then retry your ALTER USER ... WITH mysql_native_password ... command. If the INSTALL PLUGIN fails, the plugin library might not be present – check your MySQL installation. In that case, stick with caching_sha2_password; almost all modern clients support it. #10: Enabling "mysql_native_password" plugin mysql> SHOW PLUGINS; +----------------------------------+----------+--------------------+----------------+---------+ | Name | Status | Type | Library | License | +----------------------------------+----------+--------------------+----------------+---------+ | binlog | ACTIVE | STORAGE ENGINE | NULL | GPL | | sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL | | caching_sha2_password | ACTIVE | AUTHENTICATION | NULL | GPL | | sha2_cache_cleaner | ACTIVE | AUDIT | NULL | GPL | | daemon_keyring_proxy_plugin | ACTIVE | DAEMON | NULL | GPL | | CSV | ACTIVE | STORAGE ENGINE | NULL | GPL | | MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL | | InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL | | INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_TEMP_TABLE_INFO | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_VIRTUAL | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CACHED_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SESSION_TEMP_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL | | TempTable | ACTIVE | STORAGE ENGINE | NULL | GPL | | ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL | | BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL | | FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL | | ndbcluster | DISABLED | STORAGE ENGINE | NULL | GPL | | ndbinfo | DISABLED | STORAGE ENGINE | NULL | GPL | | ndb_transid_mysql_connection_map | DISABLED | INFORMATION SCHEMA | NULL | GPL | | ngram | ACTIVE | FTPARSER | NULL | GPL | | mysqlx_cache_cleaner | ACTIVE | AUDIT | NULL | GPL | | mysqlx | ACTIVE | DAEMON | NULL | GPL | | mysql_native_password | DISABLED | AUTHENTICATION | NULL | GPL | | auth_socket | ACTIVE | AUTHENTICATION | auth_socket.so | GPL | +----------------------------------+----------+--------------------+----------------+---------+ 49 rows in set (0.00 sec) mysql>
*** Only if you absolutely need mysql_native_password *** If you have a very old client/library that doesn't support caching_sha2_password, you can re-enable the disabled plugin. Because the plugin is built-in but disabled, you cannot simply INSTALL it—you must enable it in the server configuration and restart MySQL. Step 1: Edit the MySQL config file: bash sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf Step 2: Add this line under the [mysqld] section: ini [mysqld] mysql_native_password=ON Step 3: Save the file and restart MySQL: bash sudo systemctl restart mysql Step 4: Now the plugin will show ACTIVE. Log in with sudo and change the root user: sql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; sql> FLUSH PRIVILEGES; Now test without sudo—it will also work. Testing: mysql> show plugins; +----------------------------------+----------+--------------------+----------------+---------+ | Name | Status | Type | Library | License | +----------------------------------+----------+--------------------+----------------+---------+ ... | mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL | ... +----------------------------------+----------+--------------------+----------------+---------+

Connect to MySQL using DBeaver

Connect DBeaver to MySQL

🔌 Connect to MySQL using DBeaver

Follow these steps to set up a connection from DBeaver to your locally installed MySQL server (Ubuntu 25.04, MySQL 8.0.41).


Step 1: Launch DBeaver and create a new connection

  1. Open DBeaver.
  2. Create a new connection using one of these methods:
    • Click the New Database Connection button in the toolbar.
    • Go to Database → New Database Connection in the main menu.
    • Press Ctrl + Shift + N (Windows/Linux) or ⌘ + Shift + N (macOS).

Step 2: Select the MySQL driver

  1. In the “Connect to a database” window, type MySQL in the search bar to filter drivers.
  2. Choose the correct driver for your version:
    • MySQL 8 and later → select MySQL (the default driver).
    • MySQL 5.x → select MySQL 5.
    • MySQL 4.x or older → select MySQL (old).
  3. Since your server is MySQL 8.0.41, choose the MySQL driver.

Step 3: Configure the connection details

After selecting the driver, click Next. On the Main tab of the Connection Settings screen, fill in the following:

Field Value for your setup
Host localhost or 127.0.0.1 (the MySQL server is on your machine)
Port 3306 (default – leave as is unless you changed it)
Database Leave blank (to see all databases) or enter a specific database name
Username Typically root for a fresh Ubuntu installation
Password Enter the root password you set during MySQL installation
💡 Note: If you didn’t set a password and are using the default auth_socket plugin, you may need to connect as root without a password, or set one using sudo mysql and ALTER USER.

Step 4: Test and finish

  1. Click the Test Connection button.
  2. If DBeaver prompts to download the JDBC driver, confirm the download.
  3. If the test is successful, you’ll see a confirmation message.
  4. Click Finish to save the connection.

The new connection will appear in the Database Navigator panel on the left. You can now browse and manage your MySQL databases directly from DBeaver.


Note: Set password for "root" user before trying to access MySQL using DBeaver using above steps

Otherwise you will get the below error:

Saturday, July 4, 2026

SQLite-Vector: Vector Search in Your Pocket

See All on GenAI    « Previously

Vector Search in Your Pocket

How sqlite-vector brings AI-powered similarity search to any device — no cloud required

Imagine you have a mobile app that needs to find the most similar image, the best product recommendation, or the right document from a pile of data — all while the user is offline. Traditionally, that would mean sending data to the cloud, running a heavy vector database, and waiting for results. But what if your SQLite database could do all of that, right on the device, with just 30 MB of memory and no indexing wait time? That's exactly what sqlite-vector delivers.

SQLite is already the world's most used database — it's in your phone, your browser, your car, and probably your smart fridge. Sqlite-vector is an extension that adds vector search to SQLite. In plain terms, it lets you store "embeddings" (think of them as mathematical fingerprints of images, text, or audio) and then find the closest matches at lightning speed — all using standard SQL.

Why vector search matters (and why you want it offline)

Modern AI models — from ChatGPT to image recognizers — turn everything into vectors: long lists of numbers that represent the "meaning" of a piece of data. When you want to find something similar, you don't search for exact matches; you search for the nearest neighbors in this high-dimensional space.

Think of it like finding the closest cities on a map — except the map has hundreds of dimensions. That's what vector search does, and it powers:

  • Semantic search — finding documents that are conceptually similar to your query
  • Image retrieval — showing visually similar photos
  • Recommendation systems — matching users with products, videos, or music
  • Voice and audio search — identifying sounds or voice queries
  • Anomaly detection — spotting outliers in sensor data

Until now, doing this on a phone or a low-power device was tricky. You'd need a separate vector database like FAISS or Weaviate, which often means running a server, setting up complex indexes, and waiting hours for preprocessing. Sqlite-vector flips that script.

What makes sqlite-vector different?

Most vector search tools are heavyweight. They require special virtual tables, pre‑indexing phases that can take hours, and external servers. Sqlite-vector takes a radically simpler approach:

Works with ordinary SQLite tables — no special schemas
No preindexing — start searching immediately
Zero‑cost updates — add or change vectors on the fly
Offline first — works without internet
Cross‑platform — iOS, Android, Windows, Linux, macOS
Memory‑efficient — just 30 MB RAM by default

It's built in pure C with SIMD acceleration, which means it runs blazingly fast even on mobile CPUs. And because it's just a SQLite extension, you can drop it into any existing project with minimal effort.

The secret sauce: TurboQuant

One of the coolest features is TurboQuant — a clever quantization technique inspired by a Google Research paper. Instead of storing full-precision vectors (which take up a lot of space), TurboQuant compresses them into 2‑bit, 3‑bit, or 4‑bit representations.

This dramatically reduces memory and storage while still keeping search results accurate. For example, on a dataset of 1 million vectors with 768 dimensions each, raw 32‑bit floats would take about 3 GB. TurboQuant 4‑bit shrinks that to just 396 MB — about 13% of the original size. And the search is still 15 times faster than brute force.

Here's a quick look at the performance on a Mac with ARM64 (NEON):

Mode Quantized storage Full scan / query TurboQuant / query Speedup Recall@10
TurboQuant 4‑bit 396 MB 3248 ms 218 ms 14.9× 0.84
TurboQuant 3‑bit 300 MB 1727 ms 188 ms 9.2× 0.74
TurboQuant 2‑bit 204 MB 3265 ms 85 ms 38.3× 0.48

The 4‑bit mode is a great starting point — it gives a solid balance of speed, memory, and accuracy. For really tight edge budgets, 2‑bit can be a lifesaver, though you'll want to test it with your own data.

Getting started (it's really this simple)

Sqlite-vector is available as a pre‑built binary for all major platforms — Linux, macOS, Windows, Android, and iOS. You can also load it as a WASM module for browsers.

Here's the basic flow in SQL:

-- 1. Load the extension
.load ./vector

-- 2. Create a regular table (no virtual tables needed!)
CREATE TABLE images (
    id INTEGER PRIMARY KEY,
    embedding BLOB,   -- store vectors as binary blobs
    label TEXT
);

-- 3. Insert a vector (as a blob or JSON array)
INSERT INTO images (embedding, label)
VALUES (vector_as_f32('[0.3, 1.0, 0.9, 3.2, ...]'), 'cat');

-- 4. Initialize the vector column
SELECT vector_init('images', 'embedding', 'type=FLOAT32,dimension=384');

-- 5. Quantize for blazing-fast search (TurboQuant 4‑bit)
SELECT vector_quantize('images', 'embedding', 'qtype=TURBO,qbits=4');

-- 6. Search for the top 20 nearest neighbors
SELECT e.id, v.distance
FROM images AS e
JOIN vector_quantize_scan('images', 'embedding', ?, 20) AS v
ON e.id = v.rowid;

That's it. No external servers, no complex indexing, no waiting. Your vector search is ready to go.

💡 Pro tip: You can also use vector_quantize_preload() to load the quantized data into memory for a 4‑5× speedup — perfect for interactive apps.

Where does it shine?

Sqlite-vector is built for Edge AI — scenarios where you need intelligence on the device, not in the cloud.

  • Mobile apps that do on‑device image search, face recognition, or voice commands
  • Privacy‑first applications where data never leaves the user's device
  • Offline‑first tools like note‑taking apps with semantic search
  • Embedded systems in robots, drones, or IoT devices

Because it's a SQLite extension, you also get all the benefits of a full relational database — transactions, joins, filters, and ACID guarantees — combined with vector search.

The bigger picture

Sqlite-vector is part of a larger ecosystem from SQLite AI that's turning SQLite into a complete runtime for intelligent, distributed data. There's also sqlite‑sync for offline‑first sync, sqlite‑ai for on‑device LLM inference, and sqlite‑agent for autonomous AI agents — all living inside your SQLite database.

If you don't want to manage it yourself, SQLite Cloud offers a hosted version with sync, auth, edge functions, and a free tier that gives you 512 MB and 20 connections — no credit card required.

Wrapping up

Sqlite-vector is a game‑changer for anyone building AI‑powered applications that need to work offline, on mobile, or at the edge. It's fast, tiny, and dead simple to use. You don't need to learn a new database or wrestle with complex indexing — just SELECT your way to similar items.

Whether you're building a photo app, a recommendation engine, or a privacy‑first search tool, sqlite‑vector gives you superpowers right inside your SQLite database. And with TurboQuant, you get enterprise‑grade performance on devices that fit in your pocket.

Ready to try it? Head over to the GitHub repository, grab the binary for your platform, and start searching in minutes. The era of on‑device AI is here — and it speaks SQL.

Resources: GitHub · Docs · SQLite AI · Releases

All performance numbers and benchmarks are from the project's official documentation and were measured on macOS ARM64 with the NEON backend. Your mileage may vary depending on hardware and data.

See All on GenAI    « Previously
Tags: Generative AI,Database

Saturday, June 13, 2026

Snowflake (NoSQL Database) Books (Jun 2026)


Download Books    Download Report    Other Technology Book Lists

1:
Build Pipelines for AI: An Essential Guide to Smarter Data Engineering
By: 
Year Published: 2024

2:
Building the Interoperable Lakehouse: Data Strategies for AI Leaders
By: 
Year Published: 2024

3:
Bulk loading from Amazon S3 using COPY
By: Snowflake
Year Published: 2020

4:
Bulk loading from a local file system using COPY
By: Snowflake
Year Published: 2023

5:
Cassandra: The Definitive Guide
By: Unknown
Year Published: 2010

6:
Create users and grant roles
By: Snowflake
Year Published: 2023

7:
Data Modeling with Snowflake: A practical guide to accelerating Snowflake development using universal data modeling techniques
By: Serge Gershkovich
Year Published: 2022

8:
Data Trends 2026: Manufacturing
By: 
Year Published: 

9:
Database Performance at Scale: A Practical Guide
By: Unknown
Year Published: 2023

10:
Getting Started with NoSQL
By: unknown
Year Published: 2013

11:
Getting Started with Snowflake
By: Snowflake
Year Published: 2020

12:
JSON basics
By: Snowflake
Year Published: 

13:
Learning Snowflake SQL and Scripting
By: Alan Beaulieu
Year Published: 2022

14:
Load and query sample data using SQL
By: Snowflake
Year Published: 2024

15:
Load data from cloud storage (Amazon S3)
By: Snowflake
Year Published: 

16:
Load data from cloud storage (Google Cloud Storage)
By: Snowflake
Year Published: 2023

17:
Load data from cloud storage (Microsoft Azure)
By: Snowflake
Year Published: 

18:
Loading JSON data into a relational table
By: Snowflake
Year Published: 

19:
Loading and unloading Parquet data
By: Snowflake
Year Published: 2022

20:
Making Sense of NoSQL
By: unknown
Year Published: 2014

21:
Next Generation Databases: NoSQL and Big Data
By: Guy Harrison
Year Published: 2015

22:
NoSQL Distilled
By: unknown
Year Published: 2012

23:
NoSQL Distilled
By: Pramod Sadalage and Martin Fowler
Year Published: 2012

24:
NoSQL For Dummies
By: unknown
Year Published: 2015

25:
NoSQL and SQL Data Modeling
By: unknown
Year Published: 

26:
NoSQL for Mere Mortals
By: Dan Sullivan
Year Published: 2015

27:
NoSQL the Ruby Way
By: Durran Jordan
Year Published: 2012

28:
NoSQL with MongoDB in 24 Hours
By: Brad Dayley
Year Published: 2015

29:
Seven Databases in Seven Weeks: A Guide to Modern Databases and the NoSQL Movement
By: Unknown
Year Published: 2012

30:
Snowflake - The Complete Masterclass 2023
By: Unknown
Year Published: 2023

31:
Snowflake - The Definitive Guide: Architecting, Designing, and Deploying on the Snowflake Data Cloud
By: Joyce Kay Avila
Year Published: 2022

32:
Snowflake Data Engineering
By: Maja Ferle
Year Published: 2021

33:
Snowflake Essentials
By: Frank Bell
Year Published: 2021

34:
Snowflake Intelligence for CFOs
By: 
Year Published: 

35:
Snowflake PDF
By: Tom Coffing and Dave Cook
Year Published: 2016

36:
Snowflake Security: Securing Your Snowflake Data Cloud
By: Ben Herzberg and Yoav Cohen
Year Published: 2023

37:
Snowflake and SAP: Powering Enterprise AI with Unified Data and Context
By: 
Year Published: 2024

38:
Snowflake in 20 Minutes
By: Snowflake
Year Published: Unknown

39:
Snowflake the Definitive Guide
By: O'Reilly
Year Published: 2022

40:
The Essential Guide to Transactional, Analytical and Hybrid Data
By: 
Year Published: 2016

41:
The Snowflake Dummies Guide Series
By: Snowflake Inc.
Year Published: 

42:
Tuning the Snowflake Data Cloud: Optimizing Your Data Platform to Minimize Cost and Maximize Performance
By: Andrew Carruthers
Year Published: 2022


Download Books    Download Report    Other Technology Book Lists

Tags: List of Books,Database,

Sunday, December 21, 2025

Differences in connecting to MySQL from Bash Console and from MySQL Console (At PythonAnywhere)

To See All Articles About Technology: Index of Lessons in Technology
#1 MySQL Console

#2 Bash Console (With Error Message)

Can you tell me what's the issue with my bash

Yes — this is a very common PythonAnywhere confusion, and your setup is actually fine 👍
The issue is not your bash. It’s where MySQL exists on PythonAnywhere.


What you’re seeing (and why)

✅ Image 1 (MySQL console works)

You opened PythonAnywhere’s MySQL console:

pgsql
MySQL: ashishjain1545$default Server version: 8.0.40 Source distribution

✔ This is PythonAnywhere’s managed MySQL server
✔ It lives on PythonAnywhere infrastructure, not inside your bash VM
✔ PythonAnywhere connects you using TCP, not a local socket

So this works ✅


❌ Image 2 (Bash → mysql fails)

In the Bash console you ran:

bash
mysql

And got:

vbnet
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

This happens because:

There is NO local MySQL server running inside your bash container
/var/run/mysqld/mysqld.sock does not exist
❌ PythonAnywhere does not allow you to run MySQL locally

So Bash is doing exactly what it should — it’s just looking in the wrong place.


🔑 Key Concept (Important)

On PythonAnywhere:

ThingExists?
Local MySQL server in bash❌ No
/var/run/mysqld/mysqld.sock❌ No
PythonAnywhere MySQL service✅ Yes
Access via TCP host✅ Yes

✅ Correct way to use MySQL from Bash on PythonAnywhere

You must specify host, user, and database:

bash
mysql \ -u ashishjain1545 \ -h ashishjain1545.mysql.pythonanywhere-services.com \ -p

OR (short form):

bash
mysql -u ashishjain1545 -h ashishjain1545.mysql.pythonanywhere-services.com -p

Then enter your MySQL password (from the Databases tab).


❌ What NOT to do on PythonAnywhere

bash
mysql mysql -u root mysql -u ashish mysql --socket=/var/run/mysqld/mysqld.sock

These only work on machines where MySQL is installed locally, which PythonAnywhere does not allow.


✅ Correct mental model

Think of PythonAnywhere like this:

arduino
[ Your Bash Console ] | | TCP v [ PythonAnywhere MySQL Server ]

Not:

css
[ Bash ][ Local MySQL ]

✅ Summary (TL;DR)

  • ✔ Your MySQL is working

  • ✔ Your bash is working

  • ❌ There is no local MySQL daemon

  • ✅ Always connect using -h <username>.mysql.pythonanywhere-services.com

  • ✅ Or use the MySQL console tab (which you already did)


Query: $ mysql -u ashishjain1545 -h ashishjain1545.mysql.pythonanywhere-services.com -p
Tags: Technology,Database,Cloud,

Tuesday, June 10, 2025

Create a user in MySQL

Index of Lessons in Technology

To create a new user in MySQL, follow these steps after logging into the MySQL prompt as root:


✅ Step-by-Step: Create a New User in MySQL

1. Login to MySQL

bash
mysql -u root -p

Enter the root password when prompted.


2. Create the User

sql
CREATE USER 'username'@'localhost' IDENTIFIED BY 'your_password';

✅ Example:

sql
CREATE USER 'ashish'@'localhost' IDENTIFIED BY 'StrongPass@123';

3. Grant Permissions

You can grant full privileges on a database like this:

sql
GRANT ALL PRIVILEGES ON your_database.* TO 'username'@'localhost';

✅ Example:

sql
GRANT ALL PRIVILEGES ON translation_app.* TO 'ashish'@'localhost';

If the database doesn't exist yet:

sql
CREATE DATABASE translation_app;

4. Apply Changes

sql
FLUSH PRIVILEGES;

✅ Verify:

sql
SELECT User, Host FROM mysql.user;

Let me know if you'd like to grant only read access, create the user for remote access, or anything more specific.

Tags: Database,