Today we will learn how to set up the Mysql database in our shared hosting Cpanel. I am using them here Namecheap you can use any of them. There are several steps you have to follow. Read them carefully and follow them you can easily do that.

First of all, go to the terminal with your project-specific virtualenv . See how to set up virtualenv in the Django project for Cpanel hosting here and follow the Mysql database setup. Then in the next steps install this package specify here.


##)Create New Database

 

##)Give  Database Name

Here you need to put your database name and click Create Database

##)MySQL Users Add New User


fillup the MySQL Users Add New User form and click Create User


##)Add User To Database


After that, you need to checkmark the correct username and database name you just created in the previous step and hit Add.


##)Manage User Privileges


Then checkmark ALL PRIVILEGES and click make the change.

1. Mysql database installation

 pip install pymysql


2. After that we need to install mysqlclient

pip install mysqlclient


There is a valid reason that your installation will get an error. unable to execute '/usr/bin/gcc':Permission denied.Follow this to slove that. After that follow our tutorial again
    
**Mysql database client installation keep in mind that the latest version of mysqlclient will not work properly. After lots of investigation I
found mysqlclient==2.1.0 is working properly.So install mysqlclient==2.1.0 .

pip install mysqlclient==2.1.0


3. After that we need to configure our database setup in our setting.py file. Just copy this below code and change the database name to your created database name the database username to your previously created username and change the password to your own database password. Keep host, port and engine as it is.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'database name ',
        'USER': 'database username ',
        'PASSWORD': 'database password',
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

5. After completion of the previous steps your setup is complete you are good for the final steps.

python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser

 

And that's it you are ready to go with this setup. Your database connection is ready you can work with it.

Learn How to deploy django application in shared hosting

Learn How to solve: unable to execute '/usr/bin/gcc':Permission denied in Namecheap

Learn How to develop a full stack development project from planning to coding

 

hosenmdaltaf

Hosen MD Altaf

Hello! I'm Hosen MD Altaf, a passionate Software Engineer and content writer.Who's experienced in taking fullstack applications from scratch to production.Currently, I am working with python and javaScript based FullStack Web development. Over the last 2 years, I've had the opportunity to develop web applications for a handful of awesome companies / clients as a consultant and continue to do so today. My work includes developing fullstack web apps, creating backend servers,designing font-end application, small Big-data and data science projects,creating websites with python django,react.js and wordpress.I am eager to learn kew technologies and looking for new opportunitys.

Comments (6)

wave
  • John Doe

    Rana

    April 5, 2024, 4:32 a.m.

    Hi, This is Rana. I'm reaching out to offer my expertise in social media management, including strategic calendar planning, captivating post creation as per your business, e-commerce product promotion, SEO-friendly social media captions, and design services such as brochures, posters, and flyers tailored to enhance your brand's social media presence and engage your audience effectively. My rate is USD 20 per hour. I can provide you a fixed quote as per your requirements. Drop me an email at socialmedia1145@outlook.com to discuss it further.

    Reply
  • John Doe

    Cedric Slowik

    March 28, 2024, 9:18 a.m.

    We have hacked your website https://coderscaffe.com and extracted your databases. How did this happen? Our team has found a vulnerability within your site that we were able to exploit. After finding the vulnerability we were able to get your database credentials and extract your entire database and move the information to an offshore server. What does this mean? We will systematically go through a series of steps of totally damaging your reputation. First your database will be leaked or sold to the highest bidder which they will use with whatever their intentions are. Next if there are e-mails found they will be e-mailed that their information has been sold or leaked and your site https://coderscaffe.com was at fault thusly damaging your reputation and having angry customers/associates with whatever angry customers/associates do. Lastly any links that you have indexed in the search engines will be de-indexed based off of blackhat techniques that we used in the past to de-index Our targets. How do i stop this? We are willing to refrain from destroying your site's reputation for a small fee. The current fee is $3000 in bitcoins (0.044 BTC). Send the bitcoin to the following Bitcoin address (Make sure to copy and paste): 34fhmb7BUFfrdvhdxfPZ6u3LMFG8fQ3NKo Once you have paid we will automatically get informed that it was your payment. Please note that you have to make payment within 5 days after receiving this e-mail or the database leak, e-mails dispatched, and de-index of your site WiLL start! How do i get Bitcoins? You can easily buy bitcoins via several websites or even offline from a Bitcoin-ATM. What if i don't pay? We will start the attack at the indicated date and uphold it until you do, there's no counter measure to this, you will Only end up wasting more money trying to find a solution. We will completely destroy your reputation amongst google and your customers. This is not a hoax, do not reply to this email, don't try to reason or negotiate, we will not read any replies. Once you have paid we will stop what we were doing and you will never hear from us again! Please note that Bitcoin is anonymous and no one will find out that you have complied.

    Reply
  • John Doe

    Abi

    March 26, 2024, 1:07 p.m.

    Hello, I'm Abi, an English SEO copywriter and content writer. I excel in crafting blogs, articles, e-commerce product descriptions, SEO content, website content, business service descriptions, newsletter content, brochures, proofreading, social media captions, LinkedIn content, and SOPs. My rate is USD 40 for every 1000 words of content. If you don't have time to plan out your content, we can help you with that. Feel free to email me at Contentwriting011994@outlook.com with any current requirements. Thanks, Abi

    Reply
  • John Doe

    Nadine Lam

    March 25, 2024, 5:55 p.m.

    Hi, Want thousands of clients? We have compiled a list of all consumers and business's across 149 countries for you. We have a special that is running today and valid till the end of the day. Come check us out: https://coderscaffe.leadsmax.biz/ Consumer Records: 294,582,351 Business Records: 25,215,278 Selling at $99 today only.

    Reply
  • John Doe

    Amelia Brown

    March 21, 2024, 2:59 a.m.

    Hi there, We run a YouTube growth service, which increases your number of subscribers both safely and practically. - We guarantee to gain you 700-1500+ subscribers per month. - People subscribe because they are interested in your channel/videos, increasing likes, comments and interaction. - All actions are made manually by our team. We do not use any 'bots'. The price is just $60 (USD) per month, and we can start immediately. If you have any questions, let me know, and we can discuss further. Kind Regards, Amelia

    Reply
  • John Doe

    Abi

    March 2, 2024, 12:35 a.m.

    Hello, I'm Abi, an English SEO copywriter and content writer. I excel in crafting blogs, articles, e-commerce product descriptions, SEO content, website content, business service descriptions, newsletter content, brochures, proofreading, social media captions, LinkedIn content, and SOPs. My rate is USD 40 for every 1000 words of content. If you don't have time to plan out your content, we can help you with that. Feel free to email me at Contentwriting011994@outlook.com with any current requirements. Thanks, Abi

    Reply

Leave Comment

wave